当前位置:网站首页>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个人笔记
边栏推荐
- 12款大家都在用的產品管理平臺
- Want to open an account, is it safe to open an account of Huatai Securities online?
- 使用强大的DBPack处理分布式事务(PHP使用教程)
- What legal risks and qualifications should be paid attention to when building a digital collection platform?
- Crawler (2) - requests (1) | deep parsing of requests module
- . Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
- What are the advantages and disadvantages of PHP
- Project0: Games
- Wireshark TS | confusion between fast retransmission and out of sequence
- Oracle和JSON的結合
猜你喜欢

. Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks

The project bar on the left side of CodeBlocks disappears, workspace automatically saves the project, default workspace, open the last workspace, workspace (Graphic tutorial, solved)

技术分享 | Linkis参数介绍

网站源码整站下载 网站模板源代码下载

Matplotlib数据可视化基础

Google's new paper Minerva: solving quantitative reasoning problems with language models

中国探月工程独家藏品限量发售!

The idea runs with an error command line is too long Shorten command line for...

Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB

Wireshark TS | confusion between fast retransmission and out of sequence
随机推荐
CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry
技术分享 | Linkis参数介绍
flutter Uint8List格式的图片和File格式图片的互相转换
新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
106. construct binary tree from middle order and post order traversal sequence
个人商城二开逍遥B2C商城系统源码-可商用版/拼团拼购优惠折扣秒杀源码
Want to open an account, is it safe to open an account of Huatai Securities online?
flutter path_ Provider: ^2.0.10 can get temporary directory
Mutual conversion of pictures in fluent uint8list format and pictures in file format
《数据安全法》出台一周年,看哪四大变化来袭?
Guys, how to export iceberg data to MySQL? What tools are there? Neither sqoop nor dataX
爬虫(2) - Requests(1) | Requests模块的深度解析
LeetCode 438. Find all letter ectopic words in the string__ sliding window
YoDA统一数据应用——融合计算在蚂蚁风险场景下的探索与实践
Wireshark TS | 快速重传和乱序之混淆
Ask everyone in the group about the fact that the logminer scheme of flick Oracle CDC has been used to run stably in production
LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer
Error: missing revert data in call exception
Addition, deletion, modification and query of database
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》