gnvm installation node installation npm installation (valid in 2023 test)

Install gnvm

Must read instructions before installation

  • It is recommended 先安装gnvmto install node.js and npm through gnvm later. If node.js is already installed, be sure to uninstall it first and clear the environment variables.
  • Open cmd input before installation gnvm version. If the version number is not displayed, it means that gnvm has not been installed and start the installation.

Step 1: Download gnvm

  • It is recommended to download through curl, copy it to the browser and download it directly, that is
    https://github.com/Kenshin/gnvm-bin/blob/master/64-bit/gnvm.exe?raw=true -o gnvm.exe
  • You can also download what I have uploaded through Baidu Netdisk, the extraction code is 1205.
    https://pan.baidu.com/s/10L2F5X734EUEaow0vtOVAw?pwd=1205

gnvm icon

Other download methods

  • 32-bit | 64-bit common address, Box, slightly slower

  • 32-bit | 64-bit backup address, Baidu network disk, fast speed

  • 32-bit | 64-bit alternate address, Github

  • For users who have installed go, use

  • go get github.com/Kenshin/gnvm

  • For users who have installed git, use

  • gitclone [email protected]:Kenshin/gnvm-bin.git

  • For users who have curl installed, use

  • curl -L https://github.com/Kenshin/gnvm-bin/blob/master/32-bit/gnvm.exe?raw=true -o gnvm.exe

  • curl -Lhttps://github.com/Kenshin/gnvm-bin/blob/master/64-bit/gnvm.exe?raw=true -o gnvm.exe

Step 2: Configure gnvm environment variables (prerequisite: no Node.js environment)

  • Download and unzip gnvm.exe, save it to any folder (the path must not be in Chinese), and add this folder to the environment variable Path

  • My path isD:\NodeJsNew

Insert image description here

  • Add environment variables below

    Win 11:电脑-右键-属性-高级系统设置-环境变量-系统变量-Path-编辑-新建

  • To configure environment variables, please refer to Win11 Configuring Environment Variables
    Insert image description here

  • You can also add user variables
    Insert image description here

Step 3: Verify

desktop

Win+R  

enter

cmd

Enter command

 gnvm version
  • 出现此页面即安装成功

Insert image description here

Install Node.js

desktop

Win+R  

enter

cmd
  • 设置淘宝镜像(加速下载)
gnvm config registry TAOBAO

Insert image description here

  • 下载node.js(以16.20.0版本为例子)
gnvm install 16.20.0

Insert image description here

  • 查看当前node.js版本
node -v

Insert image description here

  • 查看所有node.js版本 (绿色的为当前使用版本)
gnvm ls

Insert image description here

  • 切换node.js版本 (切换18.15.0)
gnvm use 18.15.0

Insert image description here

Install npm

First of all, the versions of npm and node match. If they do not match, an error may occur. When downloading, do not download a too high version (node), nor a too low version. Version reference

Insert image description here

  • 下载相匹配的版本(global默认指定匹配版本)
gnvm npm global

Insert image description here

  • 验证版本
npm -v

Insert image description here

At this point, gnvm, node.js, and npm are all installed. This is only recorded for future reference.

Supongo que te gusta

Origin blog.csdn.net/weixin_45725923/article/details/129987116
Recomendado
Clasificación