First execute the command:
curl -o- https: // raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Then execute:
source ~/.bashrc
Execute the command to check whether the installation is successful, and the version number proves the success
nvm --version
Install nodejs with nvm
nvm install v10.15.1
After installation, you can view the version through node -v and npm -v, indicating that node and npm were successfully installed