mac下的环境变量配置- cnpm :command not found

安装cnpm后 cnpm -v却找不到

首先确认一下 npm 下载包路径: 

一.查看npm的prefix和cache设置信息 

1|npm config get prefix
2|npm config get cache

二.设置下载路径和缓存路径

1|npm config set prefix “usr/example”
2|npm config set cache “usr/example“

三.查看npm配置下信息

1|npm config list

然后配置cnpm的环境变量

环境变量 :记录电脑各种内容的位置
如何设置 : export PATH=path1/example:$PATH 

一.新建并打开 .bash_profile 文件

1|cd  ~
2|touch .bash_profile
3|open .bash_profile

二.添加cnpm的路径 保存 退出,设置全局路径

1|export PATH=$PATH:/Users/你的用户/example/bin
2|source .bash_profile
1|npm config get prefix
2|npm config get cache

猜你喜欢

转载自www.cnblogs.com/noraZhang/p/12617115.html