-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac install node&npm
More file actions
33 lines (29 loc) · 1.08 KB
/
Copy pathmac install node&npm
File metadata and controls
33 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
1.若在上文中出现,如下错误信息:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:
node
则需要如下操作:
2.清理brew的link
$ brew cleanup
3.删除node文件,完全卸载node和npm
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
4.通过brew安装node和npm
brew link node
brew uninstall node
brew install node
5. 执行以下命令查看是否安装成功
node -v:查看node版本
npm -v:查看npm版本
6.测试Node和npm安装是否成功,安装Grunt
npm install -g grunt-cli
如果安装成功,那么恭喜你node,npm,grunt均安装成功。若出现问题,请回顾前面内容。
7.查看npm 安装全局的包或者依赖包
npm list -g 查看所有
npm list -g --depth 0 查看顶级的
8.安装依赖包
npm install xxx --save
eg:npm install react-slick --save
reference:
http://www.runoob.com/nodejs/nodejs-npm.html
https://www.jianshu.com/p/20ea93641bda