Environment variables for mac configuration - cnpm: command not found

After installing cnpm cnpm -v but can not find

First confirm the download package npm path: 

A. Check the prefix npm information and cache settings 

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

II. Set the download path and cache path

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

III. View npm configuration information

1|npm config list

And then configure the environment variables cnpm

Environment variables: the computer records the location of various content
How to set: Export the PATH = path1 / Example: the PATH $

A. New and open the file .bash_profile

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

II. Cnpm add the path to save and exit, set the global path

1 | export PATH = $ PATH: / Users / your user / Example / bin
 2 | Source .bash_profile

 

 

 

 

 

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

Guess you like

Origin www.cnblogs.com/noraZhang/p/12617115.html
Recommended