前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >npm Error: EACCES: permission denied

npm Error: EACCES: permission denied

作者头像
SkyRiN
发布2019-05-15 12:50:19
1.2K0
发布2019-05-15 12:50:19
举报
文章被收录于专栏:Coding+Coding+

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.

1.Back up your computer.

2.On the command line, in your home directory, create a directory for global installations:

mkdir ~/.npm-global

3.Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

4.In your preferred text editor, open or create a ~/.profile file and add this line:

export PATH=~/.npm-global/bin:$PATH

5.On the command line, update your system variables:

source ~/.profile

or

source ~/.bash_profile

6.To test your new configuration, install a package globally without using 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

Reference from

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.07.09 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.Back up your computer.
  • 2.On the command line, in your home directory, create a directory for global installations:
  • 3.Configure npm to use the new directory path:
  • 4.In your preferred text editor, open or create a ~/.profile file and add this line:
  • 5.On the command line, update your system variables:
  • 6.To test your new configuration, install a package globally without using sudo:
  • Reference from
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档