【问题标题】:sh: 1: node-gyp-build: Permission denied and npm ERR! code ELIFECYCLE npm ERR! errno 126sh: 1: node-gyp-build: Permission denied and npm ERR!代码 ELIFECYCLE npm 错误!错误号 126
【发布时间】:2020-10-23 02:25:03
【问题描述】:

尝试在 Ubuntu 18.04 x64 上运行它。它曾经在一天前正常工作,但突然停止了。

npm i simple-youtube-api

我曾经能够安装它们,但不是任何人,我得到了这个:

> bufferutil@4.0.1 install /root/NezukoBot/node_modules/bufferutil
> node-gyp-build

sh: 1: node-gyp-build: Permission denied
npm WARN discord.js@11.5.1 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.10.0 requires a peer of sqlite@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/mocha/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! bufferutil@4.0.1 install: `node-gyp-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the bufferutil@4.0.1 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!     /root/.npm/_logs/2020-07-02T12_58_27_816Z-debug.log

我已经试过了,但我仍然得到错误:

npm config set user 0
npm config set unsafe-perm true

【问题讨论】:

  • this,这是权限问题。尝试使用 sudo 运行。
  • 即使使用 sudo 仍然无法正常工作
  • 删除 node_modules 文件夹并重新运行 sudo npm install
  • 看到这个post
  • 老实说,我不能只删除 node_modules 文件夹,因为我有很多东西,而且我大多数东西都不会安装,而且我不记得所有的模块名称

标签: node.js npm npm-install


【解决方案1】:

【讨论】:

  • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效。
  • 或者只在 npm 上使用 --unsafe-perm 标志。
猜你喜欢
  • 2020-02-12
  • 2019-04-14
  • 1970-01-01
  • 2021-01-18
  • 1970-01-01
  • 2020-09-18
  • 2020-12-27
相关资源
最近更新 更多