N PK NVM method

Time:2021-6-22
Both N and NVM upgrade and switch the node version, but there are still differences between them.
  • N is actually an open source package for NPM. It relies on NPM to install and use it globally. It’s relatively lightweight. N is a module in node. If the computer does not install node or NPM, n can’t be used
  • The full name of NVM is node version manager. NVM is an independent software package, which is more complex than n. It is implemented by shell script.

Next, we record several common commands

n

//Mac needs to be preceded by sudo
  • Installation n
npm install n -g 
  • Enter n
//Check all node versions, press enter to switch versions, MAC needs to add sudo
  • Enter n ls
N LS // view all node versions
  • Install stable version
n stable 
  • Install the latest version
//Mac needs to be preceded by sudo
n latest
  • Install the specified version
N v8.4.0 // N 8.0.0 MAC may be preceded by sudo
  • Delete a version
n rm 0.10.1 
  • Executes the script with the specified version
 n use 0.10.21 some.js 

nvm

There are two ways to install NVM in MAC

Official website:https://github.com/creationix/nvm

1. (add sudo before MAC command)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
2、
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

After installation, verify the installation

command -v nvm 
  • Install the latest stable version of node
nvm install stable 
  • Install earlier versions
nvm install 4.3.0 
  • View current version
nvm current 
  • Switch versions
nvm use 8.0.0 
  • List all versions
nvm ls 

Windows install NVM

([https://github.com/coreybutle…[https://github.com/coreybutler/nvm-windows/releases]](https://github.com/coreybutle…://github.com/coreybutler/nvm-windows/releases%5D)
As shown in the figure:

N PK NVM method

image.png

  • Node version list
nvm list 
  • Download, compile and install the current stable version
npm install stable 
  • Install a version
npm install v8.4.0 
  • Switch a version
nvm use v8.5.0 
  • Run a version
nvm run v8.4.0 

node

  • Uninstall node
//Mac computer uninstall
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
  • Install node
//Install stable version
https://nodejs.org/en/#download

Author: alipy_ two hundred and fifty-eight
Link:https://www.jianshu.com/p/e30…
Source: Jianshu
The copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please indicate the source.

Recommended Today

What is “hybrid cloud”?

In this paper, we define the concept of “hybrid cloud”, explain four different cloud deployment models of hybrid cloud, and deeply analyze the industrial trend of hybrid cloud through a series of data and charts. 01 introduction Hybrid cloud is a computing environment that integrates multiple platforms and data centers. Generally speaking, hybrid cloud is […]