Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Lyumo
Lyumo

Posted on

     

Multiple Node.js versions - setup memo

While a lot of times, installing the latest version of Node.js via preferred package manager is enough, in some cases more flexibility is needed.
For example, sometimes there are several projects to work on, each of which relies on a specific Node.js version.

This blog post presents an overview of Node.js setup to support the above scenario.

There are two commonly used tools for managing multiple Node.js versions -nvm andn.
In this post, we will usenvm.

Using nvm (Node Version Manager)

nvm, or Node Version Manager, is a solution provided by Node.js team themselves. It is anopen source with straightforward installation and usage flow.

Install with the package manager of your choice. For macOS, I will use Homebrew:

brewinstallnvm
Enter fullscreen modeExit fullscreen mode

Next, let's check available Node.js versions:

nvm ls-remote
Enter fullscreen modeExit fullscreen mode

Let's install the first version:

nvminstall <version># Replace <version> with the desired version, e.g., 18.16.0
Enter fullscreen modeExit fullscreen mode

Installed versions could be checked with:

nvmls
Enter fullscreen modeExit fullscreen mode

To switch between versions:

nvm use <version># Replace <version> with the desired version
Enter fullscreen modeExit fullscreen mode

With that, the setup of multiple Node.js versions has been completed.

It is also possible to set the version as default one withnvm alias default <version>.
Seethis answer for more details.
Finally, check the version withnode --version command.

Resources

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Finland
  • Joined

More fromLyumo

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp