Ubuntu-nodejs-npm install -g>错误:EACCES:权限被拒绝,mkdir [英] Ubuntu - nodejs - npm install -g > Error: EACCES: permission denied, mkdir
问题描述
在安装NodeJS npm
软件包时遇到问题。在Digital-Ocean Droplet Ubuntu(14.04)服务器上。
Was having a issue installing a NodeJS npm
package. On a Digital-Ocean Droplet Ubuntu (14.04) server.
npm install -g PACKAGE-NAME
我什至尝试使用 sudo
遇到相同的错误。
I even tried with sudo
had the same error.
错误消息:
Error: EACCES: permission denied, mkdir '.....etc'
推荐答案
希望这会有所帮助有人花了我一段时间来找到一种方法来安装它。
Hope this helps someone took me a while to find a way to get this to install.
sudo npm install -g PACKAGE-NAME --unsafe-perm=true --allow-root
标记的作用:
不安全的烫发- https://docs.npmjs.com/misc/config#unsafe-perm
默认值:如果以root用户身份运行则为false,否则为
类型:Boolean
设置为true以禁止UID / GID切换运行程序包脚本时。如果显式设置为false,则以非root用户身份安装将失败。
Default: false if running as root, true otherwise Type: Boolean Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.
允许root用户- https://bower.io/docs/api/#allow-root
-allow-root
允许以root用户身份运行命令。 Bower是一个用户命令,不需要超级用户权限即可执行。但是,如果您仍想使用sudo运行命令,请使用--allow-root选项。
--allow-root Allows running commands as root. Bower is a user command, there is no need to execute it with superuser permissions. However, if you still want to run commands with sudo, use --allow-root option.
这篇关于Ubuntu-nodejs-npm install -g>错误:EACCES:权限被拒绝,mkdir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!