标签:set different open use nat director 解决方案 user Edito
npm ERR! Error: EACCES: permission denied, access ‘/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk‘ npm ERR! { Error: EACCES: permission denied, access ‘/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk‘ npm ERR! stack: ‘Error: EACCES: permission denied, access \‘/Users/Lobin/work/note-vue/node_modules/@babel/highlight/node_modules/chalk\‘‘, npm ERR! errno: -13, npm ERR! code: ‘EACCES‘, npm ERR! syscall: ‘access‘, npm ERR! path: ‘/Users/Lobin/w
解决方案:官方链接
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
If you see an EACCES
error when you try to install a package globally, you can either:
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in “Downloading and installing Node.js and npm”. You do not need to remove your current version of npm or Node.js before installing a node version manager.
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.
mkdir ~/.npm-global
npm config set prefix ‘~/.npm-global‘
~/.profile
file and add this line:
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
sudo
:
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don’t want to modify ~/.profile
):
NPM_CONFIG_PREFIX=~/.npm-global
The current stable version of npm is here. To upgrade, run: npm install npm@latest -g
To report bugs or submit feature requests for the docs, please post here. Submit npm issues here.
标签:set different open use nat director 解决方案 user Edito
原文地址:https://www.cnblogs.com/lobin/p/10193261.html