当前位置:网站首页>node版本管理器nvm安装及切换
node版本管理器nvm安装及切换
2022-07-01 10:56:00 【wade3po】
这两年,只要是安装最新的稳定版本的node,一般都不会出现版本过低的情形。然而,自己碰上了版本过高,依赖安装失败、依赖版本语法不兼容。能怎么办,只能更换版本。
第一次安装node,npm版本是跟node版本绑定一起的,之后重新覆盖node,npm并不会跟着更新,需要手动更新npm到最新:
npm install -g npm
也可以更新到指定版本:
npm -g install [email protected]
安装node到指定版本方法就多了,最简单就是安装覆盖,没试过使用第三方卸载node再去安装会怎么样,直接覆盖是可以的,可以到node官网找指定版本:
https://registry.npmmirror.com/binary.html?path=node/latest-v12.x/
要哪个版本把地址v12改成你要的版本就行了,找到x64.msi(windows 64)下载直接双击安装覆盖。
node也给出了一些包管理器:
tips:网上很多使用n管理器的,这边看见的描述是:n 是一个简单易用的适用于 Mac 和 Linux 的 Node.js 版本管理器。所以windows的就不用再去尝试了。
这边推荐使用nvm去管理node版本,使用了一下确实是方便快捷。
下载nvm-setup.exe(其它环境的没找到,GitHub用脚本,不知道好不好使):
https://github.com/coreybutler/nvm-windows/releases
双击安装:
nvm安装的目录
下载的各个版本的node目录,第一次安装都是直接默认,会把这个目录指定到原本下载的node,切换版本的时候会覆盖。同事试了一下,需要跟原来node同一个目录,安装完成之后再删除原来的才能切换成功。
安装完成之后看一下nvm -version看一下版本,有了就是安装成功。
tips:安装成功之后给的提示,没试过选否,猜想选否的话原本安装的版本不受nvm控制。
- nvm install 16.15.1: 安装对应的node版本
- nvm uninstall 16.15.1:卸载对应的node版本
- nvm list: 查看已经安装的node版本
- nvm use 16.15.1:使用对应的node版本
安装完成之后,查看版本,并没有引用哪个版本的标识:
切换版本会报错:
exit status 5: �ܾ����ʡ�
exit status 1: ���ļ��Ѵ���ʱ�����������ļ���
删除原本安装的node再切换,也会报错:
exit status 1: �ܾ����
删除之后要用管理员身份运行cmd再去操作就成功了(下载安装不用):
tips:有人说在nvm目录下settings.txt加上会比较快:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
试了一下,没太多感觉,如果实在慢的可以试一下,不然还是不用了。
有一点得说一下,同事装了之后,用husky校验的崩了,找不到node,也是奇怪,最后也没有解决,换电脑了。
欢迎关注公众号 coding个人笔记
边栏推荐
- 基金管理人的合规管理
- MIT's latest paper, "the need for interpretable features: motivation and classification": building interpretability in the constituent elements of machine learning models
- LeetCode.每日一题 剑指 Offer II 091. 粉刷房子 (DP问题)
- Neurips 2022 | cell image segmentation competition officially launched!
- Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
- 内存泄漏定位工具之 valgrind 使用
- 想开个户,在网上开华泰证券的户安全吗?
- The first anniversary of the data security law, which four major changes are coming?
- CRC 校验
- Mutual conversion of pictures in fluent uint8list format and pictures in file format
猜你喜欢

技术分享 | Linkis参数介绍

Design and practice of new generation cloud native database

JS foundation -- data type

New situation of digital collection market

12款大家都在用的产品管理平台
![[MPC] ② quadprog solves positive definite, semi positive definite and negative definite quadratic programming](/img/85/56b12fd664726e4776cab69ca91d57.png)
[MPC] ② quadprog solves positive definite, semi positive definite and negative definite quadratic programming

建议收藏 | 在openGauss上遇到慢SQL该怎么办?

CRC check

谷歌新论文-Minerva:用语言模型解决定量推理问题

Matplotlib数据可视化基础
随机推荐
Win平台下influxDB导出、导入
[paper reading] trajectory guided control prediction for end to end autonomous driving: a simple yet strong Ba
Sqlachemy common operations
PHP有哪些优势和劣势
Error: missing revert data in call exception
Ask everyone in the group about the fact that the logminer scheme of flick Oracle CDC has been used to run stably in production
Suggest collecting | what to do when encountering slow SQL on opengauss?
Huawei Equipment configure les services de base du réseau WLAN à grande échelle
CRC 校验
prism journal导航按钮的可用性探索记录
The exclusive collection of China lunar exploration project is limited to sale!
flutter path_ Provider: ^2.0.10 can get temporary directory
Uncover the secrets of new products! Yadi Guanneng 3 multi product matrix to meet the travel needs of global users
12 product management platforms that everyone is using
CRC 校驗
Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
Internal control of fund managers
CRC verification
数字藏品新一轮热度开启
Yoda unified data application -- Exploration and practice of fusion computing in ant risk scenarios