To ensure that a specific version of Node.js is used even after rebooting the computer, one can follow these steps:
Install nvm
on the computer by downloading and installing the appropriate version from the official website or GitHub repository.Use nvm install
to install the desired version of Node.js.
For example, nvm install 14.3.0
will install version 14.3.0 of Node.js.
Use nvm use
to switch to the desired version of Node.js.
For example, nvm use 14.3.0
will switch to version 14.3.0 of Node.js.
Set the default version of Node.js by using nvm alias default [version]
.
For example, nvm alias default 14.3.0
will set version 14.3.0 as the default version of Node.js.
Verify that the default version has been set by using nvm list
.The default version will be marked with an asterisk (*).
Reboot the computer and verify that the default version of Node.js is still being used by running node -v
.
It's important to note that nvm
only manages Node.js versions within the context of the terminal or command prompt in which it is installed.
If a different terminal or command prompt is used, the default version of Node.js may not be set correctly.
Additionally, if multiple users are using the same computer, each user will need to install and configure nvm
separately to ensure that their preferred version of Node.js is used.