DEV Community

Cover image for Why You Should Use NVM (Node Version Manager) and How to Install It
Melvin Liu
Melvin Liu

Posted on

Why You Should Use NVM (Node Version Manager) and How to Install It

Backstory

Have you ever experience difficulties in software development due to unsupported / different version ? Recently I was facing the same issue. The issue was a different Node.js version from my machine (Node v14.18.0) with my company project repository (Node v10 required). The first solution that instantly pop up in my mind was "I think downgrade my current node by uninstalling it will do the work", But what if you need another version for another project in the near future? Do you want to endure the pain of installing and uninstalling Node.js every time you need a different version of it ?

Node Version Manager

Node Version Manager

NVM is a version manager for Node.js, it allows you to quickly install and use different versions of node via the command line.

Let's head to the tutorial !

Instaling Node Version Manager Guide

If you happen to use UNIX, macOS, or WSL (Window Sub-system for Linux), you can install and read the official documentation here

If you happen to use Windows you can install it at NVM for windows which is developed by Corey Butler, download the nvm-setup.zip file.
NVM for windows github

Important Note

Installation Guide Github
It is stated that you need to uninstall pre-existing node version, but based on my experience it is not necessary to do so.

After the installation you can open your command prompt and check whether nvm is recognized

C:\Users\YourUsername>nvm -v

Running version 1.1.8.
Enter fullscreen mode Exit fullscreen mode

If nvm is not recognized as internal command or external command, try to re-open your command prompt.

Then, You can type nvm list in order to see list of Node.js version on your machine.

C:\Users\YourUsername>nvm list

  * 14.18.0 (Currently using 64-bit executable)
    10.18.0
Enter fullscreen mode Exit fullscreen mode

If you don't see your desired Node.js version in the list, you can use nvm install command, for example if you want Node.js version 8, you can type nvm install 8.0.0

To use the installed Node.js version you can simply type nvm use 8.0.0

Note

If you see an error message exit status 5: Access is denied., It is due to admin privilege issue. To solve it you can simply run your command prompt as administrator.

Thank you for your time reading this short article / tutorial about Node Version Manager, hope it helps! and Have a great day.

Top comments (5)

Collapse
 
iamludal profile image
Ludal 🚀

I personally prefer the n npm package. I find it very simple to use and very intuitive. 🤔

Collapse
 
melvnl profile image
Melvin Liu

Ah yes, I just look into n, which can be directly installed via npm, the installation is much easier I guess.

Collapse
 
iamludal profile image
Ludal 🚀

Yes, I once tried to use nvm, but had some problems during the installation, so I tried n and it worked like at charm.

However, once nvm is installed, I guess it works pretty much the same as n.

Collapse
 
cytim profile image
Tim Wong • Edited

I love nvm too. Had been using it for many years. Recently I'm also trying out asdf. It's very much like nvm, but supports many other tools as well. I like its .tool-versions file particularly that I can specify the versions for different projects. asdf will choose the correct version automatically when I swtich the project.

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

What about nodenv?

More from Melvin Liu

Get User Current Region With Geolocation API Create and Publish Your Own NPM Package Send Message to Discord Server via Javascript

深圳SEO优化公司玉溪建站湛江百度关键词包年推广推荐莆田百度seo报价怀化SEO按天计费哪家好常州优化辽源网站seo优化公司沧州网站建设设计多少钱大浪SEO按天扣费丽江网站优化排名报价平湖网站搜索优化公司遂宁如何制作网站哪家好驻马店企业网站制作价格坂田seo推荐韶关百搜标王哪家好永州SEO按天扣费本溪网站搜索优化多少钱巴中企业网站建设公司金昌网站定制哪家好荷坳至尊标王价格木棉湾百度标王价格贵阳SEO按天收费推荐南平建设网站价格长治企业网站制作多少钱坪山seo网站推广价格绵阳网站搜索优化多少钱廊坊百度爱采购哪家好承德seo网站推广报价日照百度关键词包年推广多少钱广州百度seo多少钱坂田网站制作多少钱歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

深圳SEO优化公司 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化