sh:1:node-gyp-build:权限被拒绝,npm错误!code ELIFECYCLE npm ERR!错误126

d7v8vwbk  于 2023-06-05  发布在  Node.js
关注(0)|答案(3)|浏览(652)

尝试在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
lx0bsm1f

lx0bsm1f1#

NPM在以root身份安装软件包时非常小心。
以root或sudo身份安装全局软件包可能会损坏操作系统,因为它可能会意外替换对操作系统本身至关重要的文件。
但是,如果你仍然想继续,你知道你在做什么,你是例如。使用虚拟机,你可以做到。

npm install --unsafe-perm -g simple-youtube-api

参见unsafe-perm文档。

k2fxgqgv

k2fxgqgv2#

在我的例子中,我使用最新版本的npm解决了权限问题:

npm i -g npm@latest

相关问题