0

Im having a bad day trying to create a new project in Ionic 3. I have this versions:

  1. Ionic 3.9.2
  2. npm 6.7.0
  3. node v8.10.0

I'm using Ubuntu 18 and each time I do:

sudo ionic start test blank

I get this message:

        https://nodejs.org/download/release/v8.10.0/node-v8.10.0-headers.tar.gz
        gyp WARN install got an error, rolling back install
        gyp verb command remove [ '8.10.0' ]
        gyp verb remove using node-gyp dir: /home/abraham/.node-gyp
        gyp verb remove removing target version: 8.10.0
        gyp verb remove removing development files for version: 8.10.0
        gyp ERR! configure error 
        gyp ERR! stack Error: ENOENT: no such file or directory, open 
        '/home/abraham/='
        gyp ERR! stack     at Object.fs.openSync (fs.js:646:18)
        gyp ERR! stack     at Object.fs.readFileSync (fs.js:551:33)
        gyp ERR! stack     at readCAFile 
        (/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:472:15)
        gyp ERR! stack     at download 
        (/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:444:22)
        gyp ERR! stack     at 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:189:19
        gyp ERR! stack     at 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/mkdirp/index.js:48:26
        gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:5)
        gyp ERR! System Linux 4.15.0-43-generic
        gyp ERR! command "/usr/bin/node" 
        "/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/bin/node-gyp.js" 
        "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" 
        "--libsass_ldflags=" "--libsass_library="
        gyp ERR! cwd 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-sass
        gyp ERR! node -v v8.10.0
        gyp ERR! node-gyp -v v3.8.0
        gyp ERR! not ok 
        Build failed with error code: 1
        npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 
        (node_modules/fsevents):
        npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
        fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: 
        {"os":"linux","arch":"x64"})

        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!     /home/abraham/.npm/_logs/2019-01-26T16_26_10_675Z-debug.log

I dont know wheter if I will need to reinstal ionic since I've already tryied:

npm rebuild node-sass

Thanks for the help

  • maybe it's something with the base project you are using. How does this command work? `ionic start conference sidemenu` ? – Jonas Praem Jan 26 '19 at 18:02
  • I get the same result :c with the sidemenu option :c – Abraham García Lomeli Jan 26 '19 at 23:57
  • You don't need sudo for npm, and using it is widely considered to be bad practice. You can find info by searching "npm without sudo." Unless this is something thats specific to the newest Ionic, which I have a hard time believing, you should be able to fix the permission issue by changing your npm prefix. See my answer here for help with this: https://stackoverflow.com/a/54323596/1526037 – sbolel Jan 27 '19 at 00:20

1 Answers1

0

There are times when you do not want to change ownership of the default directory that npm uses (i.e. /usr) as this could cause some problems, for example if you are sharing the system with other users.

Instead, you can configure npm to use a different directory altogether. In our case, this will be a hidden directory in our home folder.

Make a directory for global installations:

mkdir ~/.npm-global

Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

Open or create a ~/.profile file and add this line:

export PATH=~/.npm-global/bin:$PATH

Back on the command line, update your system variables:

source ~/.profile