为什么在执行 sudo npm install npm
时会出现这个奇怪的错误?我有时在尝试安装其他模块时也会得到它!
错误:
> scrypt@6.0.3 preinstall /home/user/code/project/api_v0.8/node_modules/scrypt
> node node-scrypt-preinstall.js
> scrypt@6.0.3 install /home/user/code/project/api_v0.8/node_modules/scrypt
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/user/code/project/api_v0.8/node_modules/scrypt/build'
gyp ERR! System Linux 4.20.0-042000-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/code/project/api_v0.8/node_modules/scrypt
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN api_v0.8@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我该怎么做才能全新安装我的软件包?
最佳答案
要解决此问题,请安装 Node 版本管理器:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
用户 Node v8.15.0:
nvm install 8.15.0
nvm use 8.15.0
关于javascript - `npm install npm` 给出 gyp ERR 和 npm ERR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54040720/