安装npm模块时Ubuntu /巨大错误

时间:2019-07-13 15:26:18

标签: linux ubuntu npm npm-install

节点:12.6.0, Npm:6.10.1, Ubuntu:19.04

我跑步时遇到了一个巨大的错误 npm i <package-name>错误链接https://textsaver.flap.tv/lists/2s4g

当我包含sudo sudo i <package-name>时出现此错误

usama@usama:~/Learn/back-end/advance-nodejs/section two$ sudo npm i webworker-threads

> webworker-threads@0.7.17 install /home/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads/build'
gyp ERR! System Linux 5.0.0-20-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/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v5.0.2
gyp ERR! not ok 
npm WARN section-two@1.0.0 No description
npm WARN section-two@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webworker-threads@0.7.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the webworker-threads@0.7.17 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/usama/.npm/_logs/2019-07-13T15_25_15_922Z-debug.log
usama@usama:~/Learn/back-end/advance-nodejs/section two$ 

1 个答案:

答案 0 :(得分:0)

使用yarn代替npm解决了这个问题。