美文网首页
macOS中配置Nodejs环境

macOS中配置Nodejs环境

作者: 4164fccdcf1c | 来源:发表于2017-11-30 10:43 被阅读166次

1、安装 Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

已安装的执行更新 $ brew update
执行诊断 $ brew doctor 并根据提示修复

2、安装 Node
$ brew install node(更新 $ brew upgrade node

执行诊断 $ brew doctor

如遇如下提示:
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
执行
$ brew cleanup 清理brew的link
$ brew link node

3、安装 淘宝 NPM 镜像
$ npm install -g cnpm --registry=https://registry.npm.taobao.org

4、更新NPM
$ npm install npm@latest -g

5、查看Node和NPM版本
$ node -v
$ npm -v

相关文章

网友评论

      本文标题:macOS中配置Nodejs环境

      本文链接:https://www.haomeiwen.com/subject/qstvbxtx.html