紀錄工作經驗、相關知識,解決技術相關問題。

Node JS, 工作雜談, 未分類

NVM 教學 – 如何使用 NVM 切換 node.js 版本 – nvm 基本指令

專案開發中最常面臨的問題,就是新專案開發所使用的版本,與舊專案不一致的問題,最近開發剛好遇到新舊專案的 node.js 版本不同的問題,上網查了一下,有一款好用的 nvm 套件可以達成這個效果,這裡間單紀錄一下 nvm 的安裝方法與基本操作。

下載安裝 NVM

因為這邊使用的是windows系統,所以這邊附上 windows 的操作,有MacOS 需求的,可以前往NVM官網查看 MacOS 的相關安裝。

注意事項

前往官方中的 nvm-windows 中下載安裝檔 nvm-setup.exe ,並點開進行安裝。
步驟上基本都是直接按下一步,你會需要注意地方,會是在選擇安裝路徑時,需要考量你要放哪裡,如果你的電腦有鎖管理者權限,建議有安裝在C以外的地方

NVM 基本指令用法

以下列出 NVM 的常用基本指令

nvm -v查看 nvm 版本,同 nvm –version
nvm ls 列出已安裝版本,同 nvm list。
nvm ls available列出可以安裝的所有 node.js 版本,同 nvm list available。
nvm use <版本號>指定目前使用的 node.js 版本
nvm install <版本號>安裝指定版本的 node.js
nvm alias defaul t<版本號>預設使用 node.js 版本
NVM 基本指令

NVM – 查詢 node.js 可安裝版本

輸入 nvm list available 或 nvm ls available 會列出目前可以安裝的版本。

NVM – 查詢 node.js 可安裝版本

NVM – 查詢 node.js 目前已安裝版本

輸入 nvm list 或 nvm ls 可以查看目前安裝了哪些版本的 node.js 。

NVM – 指定安裝 node.js 版本

使用 nvm install <版本號> 指定安裝想要的 node.js 版本。

例如,當我希望安裝的版本是 14.17,直接輸入使用 nvm install 14.17 ,然後按下 Enter 即可。

NVM – 切換指定版本

使用 nvm use <版本號> 可以直接切換至目前使用的版本,切換成功會出現以下畫面。

15 留言

  1. Your article made me suddenly realize that I am writing a thesis on gate.io. After reading your article, I have a different way of thinking, thank you. However, I still have some doubts, can you help me? Thanks.

  2. Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/pt-PT/register-person?ref=W0BCQMF1

  3. Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://accounts.binance.com/sl/register?ref=W0BCQMF1

  4. Your article helped me a lot, is there any more related content? Thanks! https://www.binance.com/kz/register?ref=V2H9AFPY

  5. Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.com/sl/register?ref=B4EPR6J0

  6. Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.com/zh-CN/register?ref=WTOZ531Y

  7. I am sorting out relevant information about gate io recently, and I saw your article, and your creative ideas are of great help to me. However, I have doubts about some creative issues, can you answer them for me? I will continue to pay attention to your reply. Thanks.

  8. Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/bg/register?ref=OMM3XK51

  9. Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

  10. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  11. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  12. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  13. Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!

  14. A lot of blog writers nowadays yet just a few have blog posts worth spending time on reviewing.Really thank you! Cool.

  15. Waiting patiently for you to come home and fuck me! https://hdo.ai/DVMQq

發表迴響