简体   繁体   中英

gyp ERR! and npm ERR! while running sudo npm install

I am working on a web application project. I reinstalled my ubuntu for some problem. I am using nodejs in the backend. I deleted the node_modules folder. So I run command sudo npm install and got the long error. I have tried reinstalling npm , nodejs , node-gyp again and again but there was no exact outcome and still getting the same errors.

There is a command sudo apt-get install g++ build-essential . I did this but this g++ build-essential is already installed the latest update.

So, what could be the reason of this error I'm not getting.

void@void:~/Documents/github/luvmusic$ sudo npm install

> fibers@1.0.15 install /home/void/Documents/github/luvmusic/node_modules/fibers
> node build.js || nodejs build.js

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/void/Documents/github/luvmusic/node_modules/fibers/build'
gyp ERR! System Linux 4.13.0-43-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/void/Documents/github/luvmusic/node_modules/fibers
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
Alpine users please run: `sudo apk add python make g++`
sh: 1: nodejs: not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! fibers@1.0.15 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the fibers@1.0.15 install 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/void/.npm/_logs/2018-05-29T15_54_37_402Z-debug.log

You're using a older version of GCC for compiling your project. If you're on Ubuntu 16.04 this might help to you

sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7
gcc-7 --version

Don't forget to make a symbolic link to gcc-7 to gcc and g++-7 to g++ as default gcc and g++

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