nrm查看及使用鏡像源
全局安裝:npm i -g nrm
查看鏡像源:nrm ls ,一般會(huì)有taobao、yarn、cnpm、npm
使用某個(gè)鏡像源:nrm use taobao即可
npm修改源
npm install時(shí),npm官網(wǎng)速度慢,解決辦法是修改npm的數(shù)據(jù)源,使用淘寶鏡像
npm config set registry https://registry.npm.taobao.org
修改后可以通過這個(gè)進(jìn)行測(cè)試
npm config get registry
下次安裝直接npm i + 包名,就可以了
- 查看配置列表
npm config list
npm命令
- npm install <packageName> --force 強(qiáng)制重新安裝
- npm update <packageName> 更新模塊版本
- npm config get cache 安裝包的緩存目錄
- npm install --cache-min Infinity <package-name> 從緩存目錄安裝模塊。
yarn 配置淘寶鏡像
- 查看當(dāng)前鏡像源
yarn config get registry - 設(shè)置淘寶鏡像
yarn config set registry https://registry.npm.taobao.org
yarn與npm命令對(duì)照

image.png
npx
- npx可以直接在命令行中調(diào)用模塊,一般項(xiàng)目調(diào)用模塊在script字段中
- npx可以調(diào)用全局模塊
- 強(qiáng)制使用本地模塊,--no-install
- 使用遠(yuǎn)程模塊,--ignore-existing