当前位置:网站首页>How to switch nodejs versions at will?
How to switch nodejs versions at will?
2022-07-26 18:02:00 【A little rain in Jiangnan】
SongGe is currently recording TienChin Project video ~ use Spring Boot+Vue3 Technology stack , It will involve all kinds of fun technologies , Little friends, come and do a super high completion rate with brother song 90% Project , Poke here -->TienChin Here comes the supporting video of the project .
Let's have a simple one on Friday , Take it easy ~
My friends know that brother song has been recording recently TienChin Video project , The front end uses Vue3, This is for RuoYi-Vue3, This scaffold is used in the front end yarn, And also used some plug-ins , Lead to Node Version must be >=14.
Preparing to update my Node When , Suddenly I remembered that there was my personal website on my computer www.javaboy.org, This website I use Hexo stay 2019 Built in , Used at that time Hexo The version of is also relatively old , If you use a higher version of NodeJS Will lead to my Hexo There's a problem with the operation ( This pit has been stepped on once before ), If you reinstall the latest version Hexo It is estimated that there is no problem , But I made a lot of customization for my personal website , Not just modify Hexo Configuration of , I even changed a lot of code myself , So if you reinstall Hexo Also bother , There are many things to change , It's too much trouble .
reasoning , If you can install several different on your computer NodeJS The version is good , And the installation should be convenient without too much trouble ( Otherwise, I might as well toss my Hexo), Then take a look NVM.
As Java The engineer , I think this NVM It's very convenient , But the professional front-end engineer saw , You may feel a little naive haha .
1. NVM
NVM yes Mac Under the node Management tools , When I first saw this tool , I think of it. Ruby Medium rvm( Before that 《Spring Boot+Vue Full stack development practice 》 In a Book , In order to teach everyone to build Redis colony , I have to teach you to use rvm install Ruby).
If management is needed Windows Under the node, Official recommendation nvmw or nvm-windows, however ,nvm-windows Not at all nvm A simple transplant of , They have nothing to do with it .
In most cases ,Windows Under the nvm and mac Inside nvm There is no big difference in use , Basically consistent , There will be some different commands , In this article, I will sort out with you .
2. install
Remember to install what you installed before NodeJS Delete the , Otherwise, there may be conflicts .
Windows It's easy to say , The control panel finds the corresponding file and uninstalls it directly ,Mac Then execute the following command to delete :
sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.dLet's do it in one meal , Then execute the following command , If the corresponding command cannot be found , That means the deletion is successful :
node -v
// -bash: /usr/local/bin/node: No such file or directory
npm -v
// -bash: /usr/local/bin/npm: No such file or directoryWindows There's one on exe file , Double click the installation directly , There's nothing to say about this .
Mac perhaps Linux On, we can directly install online , Very convenient :
have access to curl Command to install :
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashYou can also use wget Command to install :
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash After execution , adopt nvm -v Command to check whether the installation is successful :
3. Use
Using commands is also relatively easy . List a common command for the partners :
Specify the current Node edition :
$ nvm use 16
Now using node v16.9.1 (npm v7.21.1)
$ node -v
v16.9.1
$ nvm use 14
Now using node v14.18.0 (npm v6.14.15)
$ node -v
v14.18.0To install a Node edition :
$ nvm install 12
Now using node v12.22.6 (npm v6.14.5)
$ node -v
v12.22.6View the currently installed Node edition :
nvm lsSee what's available Node edition :
# Mac
nvm ls-remote
# Windows
nvm list available4. Summary
All right. , If the partners also have to use different Node Version of trouble , Then try this ~
边栏推荐
- [training day3] section
- Hardware development and market industry
- AI zhetianchuan ml unsupervised learning
- RedisDesktopManager去除升级提示
- 1、 C language program structure, compilation and operation, data type related
- A detailed explanation of throughput, QPS, TPS, concurrency and other high concurrency indicators
- 即刻报名|飞桨黑客马拉松第三期盛夏登场,等你挑战
- 【元宇宙欧米说】剖析 Web3 风险挑战,构筑 Web3 生态安全
- Linux Installation mysql8.0.29 detailed tutorial
- Laozi cloud and Fuxin Kunpeng achieved a major breakthrough in 3D ofd 3D format documents for the first time
猜你喜欢

【静态代码质量分析工具】上海道宁为您带来SonarSource/SonarQube下载、试用、教程

kaggle猫狗数据集开源——用于经典CNN分类实战

【集训Day3】Reconstruction of roads

【欧米读书会】谈谈元宇宙中的创作者经济:无限次元

天翼云Web应用防火墙(边缘云版)支持检测和拦截Apache Spark shell命令注入漏洞

AI遮天传 ML-无监督学习

CCS tm4c123 new project

2、 Topic communication principle, code implementation

SQL中去去重的三种方式

Spark unified memory partition
随机推荐
# MySQL 七种连接方式图解
AI遮天传 ML-无监督学习
Spark数据格式UnsafeRow
[cloud native] IVX low code development was introduced into Tencent map and previewed online
Sequential storage structure of linear table -- sequential table
兆骑科创海外高层次人才引进平台,创业赛事活动路演
点击劫持攻击
SQL中去去重的三种方式
JS recursive Fibonacci sequence deep cloning
【集训Day3】Reconstruction of roads
Basic select statement
How to assemble a registry?
The Agile Manifesto has four values and twelve principles
Come on developer! Not only for the 200000 bonus, try the best "building blocks" for a brainstorming!
quartz触发器规则
带你熟悉云网络的“电话簿”:DNS
1、 C language program structure, compilation and operation, data type related
Linux Installation mysql8.0.29 detailed tutorial
Hardware development and market industry
AI sky covering DL multilayer perceptron