我正在开发一个Web应用程序项目。我重新安装了我的ubuntu以解决一些问题。我在后端使用nodejs。我删除了node_modules
文件夹。所以我运行命令sudo npm install
并得到了很长的错误。我已经尝试过一次又一次地重新安装npm
,nodejs
,node-gyp
,但没有确切的结果,仍然会遇到相同的错误。
有一个命令sudo apt-get install g++ build-essential
。我这样做但是g++ build-essential
已经安装了最新的更新。
那么,这可能是我没有得到这个错误的原因。
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
答案 0 :(得分:0)
您正在使用较早版本的GCC来编译项目。如果您使用的是Ubuntu 16.04,这对您有帮助
sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7
gcc-7 --version
不要忘记将gcc-7的符号链接作为gcc和g ++ - 7到g ++作为默认gcc和g ++