0%

npm

1. 安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# nvm 安装
# https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

# 由于 nvm 启动比较慢, 所以使用手工方式加载
# 先清理 .bashrc .zshrc 中的 nvm 环境信息
# 在环境配置中添加:
snvm(){
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}

# 下载安装 nodejs
nvm ls-remote
nvm install [lastest-version]
nvm install --lts

# npm 配置 taobao registry
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
npm install cnpm -g --registry=http://registry.npm.taobao.org

2. Resource

NVM Guides CNPM