- Open a terminal and run the following command to install the required packages:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
- Then, run the following command to download and install nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
This will download the nvm installation script and run it.
- Once the installation is complete, you’ll need to add the following line to your shell configuration file (e.g.
~/.bashrcor~/.zshrc) to enable nvm:
source ~/.nvm/nvm.sh
- Reload your shell configuration file by running:
source ~/.bashrc
(or source ~/.zshrc if you’re using zsh)
- Verify that nvm is installed by running:
nvm --version
This should display the version of nvm that you just installed.
That’s it! You should now be able to use nvm to manage multiple versions of Node.js on your Ubuntu system.
Note: If you’re using a newer version of Ubuntu, you may need to use the curl command with the -s flag to suppress the progress meter, like this:
curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
1639

被折叠的 条评论
为什么被折叠?



