node.js - sh : 1: node-gyp-build: Permission denied and npm ERR! 代码 ELIFECYCLE npm ERR!错误号 126

标签 node.js npm npm-install

试图在 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

最佳答案

只需尝试在 root 以外的用户下运行该命令。
https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/

关于node.js - sh : 1: node-gyp-build: Permission denied and npm ERR! 代码 ELIFECYCLE npm ERR!错误号 126,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62697156/

相关文章:

javascript - 在成功安装 sqlite3 后尝试运行代码时如何修复此 "module not found error"?

javascript - Eslint:如何在 Node.js 中禁用 "unexpected console statement"?

git - 从私有(private) Bitbucket 安装 NPM 模块时主机 key 验证失败

javascript - Facebook 和 google 如何随机化 html 选择器 id 和类名?

javascript - 创建 react 应用程序 : How do I "npm start" with a specific browser?

javascript - 为什么我运行“npm install”时会得到很多包?

reactjs - 将 ReactJS 与 npm 一起使用及其给出以下错误(意外标记)

node.js - 在dokku中运行的phoenix项目中使用sass

javascript - 使 javascript 字符串 sql 友好

javascript - 在 Selenium WebDriverJS 中使用 getWindowHandles 时出错