nvm, the Node Version Manager, installs multiple Node.js versions so each project can use an appropriate runtime. It avoids relying on an outdated system package when an application needs a newer release. section 3.4 section 3.4.2
A practical nvm setup follows these steps:
- Install a chosen nvm release with the official installation script, piping its curl response to bash. section 3.4.2
- Verify nvm with nvm --version, then install the latest LTS release or a specific Node.js version. section 3.4.2
- Install application dependencies with npm install after entering the Node.js project directory. section 3.4.2
Installing nvm and Node.js
export NVM_VERSION="v0.39.3" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash nvm --version nvm install --lts nvm install 18.15.0 section 3.4.2
Listing 3.21 Installing the Node Version Manager
export NVM_VERSION="v0.39.3" #1
curl -o- \
https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh \
| bash
View the complete installation command, including the pinned nvm version and official installation URL. section 3.4.2
Listing 3.22 Verifying nvm is installed
nvm --version #1 nvm install --lts #2 nvm install 18.15.0 #3
Compare commands for verifying nvm and installing either the latest LTS release or a specific Node.js version. section 3.4.2
