Ubuntu install Node and npm

  This article introduces the latest version of the node and npm on Ubuntu.

  The test environment is Ubuntu 18.10.

  Installation nodejs

root@ubuntu:~# cat /etc/issue
Ubuntu 18.10 \ n \ l

root@ubuntu:~# sudo apt install nodejs -y
...

  Install npm

# Apt install above sea level s

  View the currently installed version

root@ubuntu:~# sudo node -v
v8. 11.4 
root @ ubuntu: ~ # sudo above sea level - v
 5.8 . 0

  Npm modify the source, increase download speed

# sudo npm config set registry https://registry.npm.taobao.org
# sudo npm config list 

  Npm upgrade to the latest version

# Sudo install altitude above sea level @ latest -g

  Mounting module for managing node of the n

# sudo npm install -g n

  N-node version Installation module

# Sudo n latest # latest version
# Sudo n stable # latest stable version
# Sudo n lts # long-term support version

  We have chosen to install the latest version, see the version installed again.

root@ubuntu:~# sudo node -v
v12. 4.0 
root @ ubuntu: ~ # sudo above sea level - v
 6.9 . 0

  the above!

Guess you like

Origin www.cnblogs.com/Hi-blog/p/How-To-Install-Node-And-Npm-On-Ubuntu.html