简体   繁体   中英

Installing npm node-sass

I have a project in vue.js. I can't install npm because I this error:

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/devel2   /Documents/vuejs/platzi-music/node_modules/node-sass/build'
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/local/bin/node" "/home/devel2/Documents/vuejs/platzi-music/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/devel2/Documents/vuejs/platzi-music/node_modules/node-sass
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

I tried with:

 sudo chmod -R 777 node_modules

I resinstalled nodejs to 8.XX

 sudo npm node-sass -F

But anything working.

Any idea? Thanks.

This solved my problem: I was also running as root(with sudo) so NPM disables scripts automatically. Then passing the --unsafe-perm to the npm install command solved the whole thing. I was using it with Angular-Cli but the error was so similar.

sudo npm install node-sass --unsafe-perm 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM