0%

NodeJs安装

引子

安装NodeJs

Node安装

Windows

官网下载
https://nodejs.org/en/
我用的是v6.10
安装完使用 node -v 验证下

Mac

  1. 安装 homebrew
1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. brew 升级
1
brew update
  1. 确保brew安全可靠
1
brew doctor
  1. 修复警告

  2. 通过brew安装node和npm

1
2
3
brew link node
brew uninstall node
brew install node

Linux

替换brew镜像源

1
2
3
4
5
6
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

替换nodejs镜像源

1
2
3
4
5
6
7
8
// 设置 淘宝镜像源
npm config set registry https://registry.npm.taobao.org

// 查看 使用的 镜像源
npm config get registry

// 安装 淘宝镜像源
npm install -g cnpm --registry=https://registry.npm.taobao.org

欢迎关注我的其它发布渠道