无法在节点16.14 docker容器中安装`@nuxtjs/sentry`。权限错误

发布于 2025-02-10 05:22:41 字数 584 浏览 1 评论 0原文

我正在尝试使用npm install @nuxtjs/sentry安装@nuxtjs/sentry。这些是我遇到的错误。

npm ERR! code 1
npm ERR! path /app/node_modules/@sentry/cli
npm ERR! command failed
npm ERR! command sh -c node ./scripts/install.js
npm ERR! info sentry-cli Downloading from https://downloads.sentry-cdn.com/sentry-cli/1.74.4/sentry-cli-Linux-x86_64
npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/sentry-cli'
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-24T08_02_47_860Z-debug-0.log
exited with code 1

I'm trying to install @nuxtjs/sentry using npm install @nuxtjs/sentry. These are the errors I'm getting.

npm ERR! code 1
npm ERR! path /app/node_modules/@sentry/cli
npm ERR! command failed
npm ERR! command sh -c node ./scripts/install.js
npm ERR! info sentry-cli Downloading from https://downloads.sentry-cdn.com/sentry-cli/1.74.4/sentry-cli-Linux-x86_64
npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/sentry-cli'
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-24T08_02_47_860Z-debug-0.log
exited with code 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生死何惧 2025-02-17 05:22:41

您可能需要使用unsafe-perm

的项目的根目录中添加一个名为.npmrc的文件

unsafe-perm=true

: 't确认这一点)

sudo npm config set unsafe-perm true

基本上是NPM将软件包下载为root,但随后尝试将二进制文件安装为本地用户,而无需根本权限,因此它无法访问下载二进制文件的目录。

您最好仔细检查安装的包裹以确保它们值得信赖,否则可以安全地这样做

注意:我仅在节点14上尝试过它,没有在节点16上进行测试

You probably need to use unsafe-perm

either:

add a file called .npmrc in your project's root directory and put this in it

unsafe-perm=true

OR

just use this command before installing (I didn't confirm this)

sudo npm config set unsafe-perm true

Basically npm would download the packages as root but then try to install the binaries as a local user without root permissions so it wouldn't have access to the directory where the binaries were downloaded at.

You just better double check the packages that you install to make sure they are trustworthy, otherwise it's safe to do so

Note: I only tried it on node 14, didn't test it on node 16

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文