Problem starting a ionic app


#1

Hello !
I’m new with ionic and I struggling to start a new app using sudo ionic start --pro-id xxxxxxxxx

The error is :

npm WARN deprecated object-keys@0.2.0: Please update to the latest 
        object-keys
        
        > fsevents@1.1.2 install /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/fsevents
        > node install
        
        [fsevents] Success: "/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" 
        already installed
        Pass --update-binary to reinstall or --build-from-source to recompile
        
        > node-sass@4.5.3 install /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass
        > node scripts/install.js
        
        Unable to save binary /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/vendor/darwin-x64-57 : { 
        Error: EACCES: permission denied, mkdir '/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/vendor'
             at Object.fs.mkdirSync (fs.js:885:18)
             at sync (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/mkdirp/index.js:71:13)
             at Function.sync (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/mkdirp/index.js:77:24)
             at checkAndDownloadBinary (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/scripts/install.js:111:11)
             at Object.<anonymous> (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/scripts/install.js:154:1)
             at Module._compile (module.js:635:30)
             at Object.Module._extensions..js (module.js:646:10)
             at Module.load (module.js:554:32)
             at tryModuleLoad (module.js:497:12)
             at Function.Module._load (module.js:489:3)
           errno: -13,
           code: 'EACCES',
           syscall: 'mkdir',
           path: '/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/vendor' }
        
        > uglifyjs-webpack-plugin@0.4.6 postinstall /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/uglifyjs-webpack-plugin
        > node lib/post_install.js
        
        
        > node-sass@4.5.3 postinstall /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass
        > node scripts/build.js
        
        Building: /usr/local/bin/node /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-gyp/bin/node-gyp.js rebuild 
        --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= 
        --libsass_library=
        gyp info it worked if it ends with ok
        gyp verb cli [ '/usr/local/bin/node',
        gyp verb cli   '/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-gyp/bin/node-gyp.js',
        gyp verb cli   'rebuild',
        gyp verb cli   '--verbose',
        gyp verb cli   '--libsass_ext=',
        gyp verb cli   '--libsass_cflags=',
        gyp verb cli   '--libsass_ldflags=',
        gyp verb cli   '--libsass_library=' ]
        gyp info using node-gyp@3.6.2
        gyp info using node@8.9.0 | darwin | x64
        gyp verb command rebuild []
        gyp verb command clean []
        gyp verb clean removing "build" directory
        gyp verb command configure []
        gyp verb check python checking for Python executable "python2" in the 
        PATH
        gyp verb `which` failed Error: not found: python2
        gyp verb `which` failed     at getNotFoundError 
        (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:13:12)
        gyp verb `which` failed     at F (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:68:19)
        gyp verb `which` failed     at E (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:80:29)
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:89:16
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/index.js:42:5
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/mode.js:8:5
        gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
        gyp verb `which` failed  python2 { Error: not found: python2
        gyp verb `which` failed     at getNotFoundError 
        (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:13:12)
        gyp verb `which` failed     at F (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:68:19)
        gyp verb `which` failed     at E (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:80:29)
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:89:16
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/index.js:42:5
        gyp verb `which` failed     at /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/mode.js:8:5
        gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
        gyp verb `which` failed   stack: 'Error: not found: python2\n    at 
        getNotFoundError (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:13:12)\n    at F 
        (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:68:19)\n    at E 
        (/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:80:29)\n    at 
        /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/which/which.js:89:16\n    at 
        /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/index.js:42:5\n    at 
        /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/isexe/mode.js:8:5\n    at 
        FSReqWrap.oncomplete (fs.js:152:21)',
        gyp verb `which` failed   code: 'ENOENT' }
        gyp verb check python checking for Python executable "python" in the 
        PATH
        gyp verb `which` succeeded python /usr/bin/python
        gyp verb check python version `/usr/bin/python -c "import platform; 
        print(platform.python_version());"` returned: "2.7.10\n"
        gyp verb get node dir no --target version specified, falling back to 
        host node version: 8.9.0
        gyp verb command install [ '8.9.0' ]
        gyp verb install input version string "8.9.0"
        gyp verb install installing version: 8.9.0
        gyp verb install --ensure was passed, so won't reinstall if already 
        installed
        gyp verb install version is already installed, need to check 
        "installVersion"
        gyp verb got "installVersion" 9
        gyp verb needs "installVersion" 9
        gyp verb install version is good
        gyp verb get node dir target node version installed: 8.9.0
        gyp verb build dir attempting to create "build" dir: 
        /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/build
        gyp ERR! configure error 
        gyp ERR! stack Error: EACCES: permission denied, mkdir 
        '/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass/build'
        gyp ERR! System Darwin 16.7.0
        gyp ERR! command "/usr/local/bin/node" "/Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
        "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" 
        "--libsass_library="
        gyp ERR! cwd /Users/jim/Documents/Projets 
        Cordova/Tutos/testsuici/node_modules/node-sass
        gyp ERR! node -v v8.9.0
        gyp ERR! node-gyp -v v3.6.2
        gyp ERR! not ok 
        Build failed with error code: 1
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! node-sass@4.5.3 postinstall: `node scripts/build.js`
        npm ERR! Exit status 1
        npm ERR! 
        npm ERR! Failed at the node-sass@4.5.3 postinstall script.
        npm ERR! This is probably not a problem with npm. There is likely 
        additional logging output above.
        
        npm ERR! A complete log of this run can be found in:
        npm ERR!     /Users/jim/.npm/_logs/2017-11-06T15_04_27_542Z-debug.log

npm -v is 5.5.1
node -v is v8.9.0

and ionic -v oddly returns

ionic -v
3.16.0
TypeError: msg.trim is not a function
    at Logger.log (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:78:21)
    at Logger.error (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:35:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/dist/index.js:269:22)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:101:69)
    at <anonymous>

Thank you for your concerns.
Jim


#2

Don’t use sudo. If you do, you could install mistakes that are very hard to remove. Maybe this has already happened.

Use ionic info to get system data, not ionic -v. Your ionic cli version is 3.16. Your ionic-angular version is different.


#3

Thank you for your answer. Maybe thats what happened… :sweat: I’ll keep that in mind.

ionic info is

ERROR] Error with ./node_modules/@ionic/app-scripts/package.json file: 
        FILE_NOT_FOUND

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.16.0
    ionic (Ionic CLI) : 3.16.0

local packages:

    @ionic/app-scripts : not installed
    Ionic Framework    : ionic-angular 3.8.0

System:

    Node : v8.9.0
    npm  : 5.5.1 
    OS   : macOS Sierra

Misc:

    backend : pro

TypeError: msg.trim is not a function
    at Logger.log (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:78:21)
    at Logger.error (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:35:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/dist/index.js:269:22)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:101:69)
    at <anonymous>

So ionic angular version is different. Not sure if they supposed to be the same.


#4

There are a lot of moving parts. You need:

Not Ionic: NodeJS, npm, Cordova, Angular
Ionic: ionic-angular, ionic-cli, ionic-app-scripts, ionic-native (optional-ish)

I haven’t tried to start by installing pro, so maybe things are different there and this advice isn’t on point. But in general the conventional wisdom on this forum is: Install nvm (node version manager), use nvm to install NodeJS and npm (8.9.0 is 100% what you want, that part looks great), then inside that node environment run npm install -g ionic cordova.


#5

Ok. I take it from here and will work on it on my own. Thank you for your answers.


#6

I have the exact same problem as you. Ugh. Not sure how to fix this.
I tried totally uninstalling Node/NPM/Cordova/Ionic …and reinstalling. No luck.

The problem persists. Very frustrating.