简体   繁体   English

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

[英]Unable to install `@nuxtjs/sentry` in Node 16.14 docker container. Permission errors

I'm trying to install @nuxtjs/sentry using npm install @nuxtjs/sentry .我正在尝试使用npm install @nuxtjs/sentry @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

You probably need to use unsafe-perm您可能需要使用unsafe-perm

either:任何一个:

add a file called .npmrc in your project's root directory and put this in it在项目的根目录中添加一个名为.npmrc的文件并将其放入其中

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.基本上,npm 会以 root 身份下载软件包,然后尝试以没有 root 权限的本地用户身份安装二进制文件,因此它无法访问下载二进制文件的目录。

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注意:我只在节点 14 上尝试过,没有在节点 16 上测试过

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM