Ubuntu - nodejs - npm install -g > Error: EACCES: permission denied, mkdir

混江龙づ霸主 提交于 2019-12-31 21:09:07

问题


Was having a issue installing a NodeJS npm package. On a Digital-Ocean Droplet Ubuntu (14.04) server.

 npm install -g PACKAGE-NAME

I even tried with sudo had the same error.

Error message:

Error: EACCES: permission denied, mkdir '.....etc' 

回答1:


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

What the flags do:

unsafe-perm - https://docs.npmjs.com/misc/config#unsafe-perm

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.

allow-root - https://bower.io/docs/api/#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.



来源:https://stackoverflow.com/questions/46439403/ubuntu-nodejs-npm-install-g-error-eacces-permission-denied-mkdir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!