npm Missing write access to /usr
2020-03-15 本文已影响0人
Alex0825
# 第一步:在你的用户文件下新建一个文件夹,这个.npm-global 名字可以用你自己喜欢的名字替换,推荐直接使用这个名字。
mkdir ~/.npm-global
#第二步:更改node的安装连接
npm config set prefix '~/.npm-global'
#第三步:在用户的profile下增加path,为的是系统能够找到可执行文件的目录
touch ~/.bash_profile
vi ~/.bash_profile
export PATH=~/.npm-global/bin:$PATH
esc wq
#第四步:update profile。使其生效
source ~/.bash_profile