4

实际上我正在尝试安装express-basic-auth,但由于安装scrypt@6.0.3. 我已经尝试过:

sudo apt-get install build-essential

并且还尝试~/.node-gyp按照此处所述删除:https ://github.com/nodejs/node-gyp/issues/809 ,但没有任何建议有帮助。我仍然得到同样的错误:

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/user/code/a/b/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/a/b/node_modules/scrypt
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN b@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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2018-12-30T20_52_24_060Z-debug.log

有人可以帮忙吗?

4

1 回答 1

2

我通过在本地安装早期版本的节点解决了这个问题,在我的例子中是节点 8.10.0 版本。我不再遇到您在这里遇到的相同错误。删除你的节点模块和 package-lock.json 然后运行

npm install --save node@earlierversion
npm install rest of packages

这就是我重建节点模块并防止此错误的方法。

于 2019-10-15T00:14:42.547 回答