node installation guide

Many times, different projects require different node versions. We constantly switch versions to develop projects. Uninstalling and installing again and again is very inefficient, so we can use nvm (node ​​version manager) to manage the node version. Every time When using different versions, you can switch the node version through nvm

1. nvm installation

First we download nvm, download address: https://github.com/coreybutler/nvm/releases, we download the installation version of setup, as shown below

Insert image description here

After the download is complete, unzip and install. The following figure shows the installation address.

Insert image description here

Then the shortcut address, then keep clicking next until installation

Insert image description here

2. Install node

After the installation is successful, you can install node through the nvm command, such as

nvm install 14.7.0 // 安装14.7.0版本的nodejs

When installing multiple node versions, you can use nvm use version number to switch versions.

nvm use 14.7.0

Check which node versions are available in local nvm

nvm list

3. Modify the image

The default npm address downloads resources very slowly, so we modify the mirror address to increase the resource download speed. Choose one of the following 设置npm镜像and the other two安装cnpm镜像

  • View mirror address

    npm config get registry
    
  • Set npm mirror (directly modify npm mirror address)

    npm config set registry https://registry.npm.taobao.org
    
  • Install cnpm image (modified npm default image, no need to install cnpm)

    npm install -g cnpm --registry=https://registry.npm.taobao.org
    

    Just replace it with cnpm when using the npm command in the future.

4. Install vue

After we install node, we can install vue to create a vue project

npm install -g @vue/cli

Guess you like

Origin blog.csdn.net/jl15988/article/details/114823423