Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use tools to switch node versions

Shulou Source: shulou.com Published: 2022-06-02 23:57:35 11月13日 Update

This article mainly explains "how to use tools to switch node versions". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "how to use tools to switch node versions".

I had never encountered the need to switch node versions before, until one day, when I was running a project, there was an error: ReferenceError: primordials is not defined. The reason for this error is that the node version I am using is too high, so I need to lower the node version. [recommended: "nodejs tutorial"]

Learn to switch node versions with tools

In fact, it is common to use different versions of node on a computer, because you can't guarantee that your current project is to use the latest node, and you don't rule out old projects. If you switch frequently, you can't uninstall it and reinstall it.

At this point, you can use a node version management tool.

My computer is win, so I use nvm, which is OK.

Download nvm and install (nvm-setup.zip recommended) https://github.com/coreybutler/nvm-windows/releases

The nvm basic command uses the

View the nvm installation version

Nvm vbat / or nvm version

View all installable Node version numbers

Nvm list available

View the installed version of node

Nvm ls// or nvm list

Installation

/ / install the specified version (recommended) nvm install 14.8.0

Unloading

/ / 14.8.0 is the version number nvm uninstall 14.8.0

Use the specified version of node

/ / 14.8.0 is the version number nvm use 14.8.0

View all commands

Nvm help thank you for your reading, the above is the content of "how to use tools to switch node versions". After the study of this article, I believe you have a deeper understanding of how to use tools to switch node versions, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Version switch tool study situation project recommendation content command that is computer different frequent reason can make common ideas tutorials articles time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft OPPO Reno macOS vpn