mac系统
1、清除npm缓存,执行命令
npm cache clean -f
- 1
2、n定制app开发模块是专门用来管理的版本,安装n模块
npm install -g n
- 1
3、更新
n stable // 定制app开发把当前系统的 Node 更新成最新的 “稳定版本” n lts // 长期支持版 n latest // 最新版 n 10.14.2 // 指定安装版本
- 1
- 2
- 3
- 4
4、查看升级后的node版本
node -v
- 1
npm 升级到最新版本
npm install -g npm
- 1
1
npm升级到指定版本
//比如升级到5.6.0
npm install -g npm@5.6.0
- 1
npm与nodejs版本对应关系:
https://nodejs.org/zh-cn/download/releases/
npm install @vue/cli 卡在了 reify:rxjs: timing reifyNode: node_modules/@vue/cli/node_modules/…
随后产生报错
查了一堆东西,后来发现其主要原因在于源的问题。安装完nodejs之后默认镜像源为 淘宝镜像源
使用npm命令或者nrm命令切换镜像源至npm官方镜像源即可
注:本人长期科学上网因此npm官方源速度和淘宝基本没差,如果没有科学上网手段的朋友可能需要另想办法。
再注:淘宝镜像源出问题的原因尚未查明,有待深究
npm镜像源切换指令:
npm set registry https://registry.npm.taobao.org/
1
或者安装nrm对镜像源进行管理
npm install -g nrm
nrm ls //查看镜像源, *表示正在使用的
* npm -------- https://registry.npmjs.org/ yarn ------- https://registry.yarnpkg.com/ cnpm ------- http://r.cnpmjs.org/ taobao ----- https://registry.npm.taobao.org/ nj --------- https://registry.nodejitsu.com/ npmMirror -- https://skimdb.npmjs.com/registry/ edunpm ----- http://registry.enpmjs.org/
- 1
- 2
- 3
- 4
- 5
- 6
- 7
nrm use taobao //切换