首页 > 系统服务 > 详细

[Tools] Install npm packages globally without sudo on macOS and Linux

时间:2020-01-27 22:50:32      阅读:113      评论:0      收藏:0      [点我收藏+]
1 . Create a directory for global packages
mkdir "${HOME}/.npm-packages"
2. Tell npm where to store globally installed packages
npm config set prefix "${HOME}/.npm-packages"
3. Ensure npm will find installed binaries and man pages

Add the following to your .bashrc/.zshrc:

NPM_PACKAGES="${HOME}/.npm-packages"

export PATH="$PATH:$NPM_PACKAGES/bin"

# Preserve MANPATH if you already defined it somewhere in your config.
# Otherwise, fall back to `manpath` so we can inherit from `/etc/manpath`.
export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"

 

Last:

source ~/.bashrc

 

[Tools] Install npm packages globally without sudo on macOS and Linux

原文:https://www.cnblogs.com/Answer1215/p/12237014.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!