nvm1.1.9 /nodejs 13.14.0 /WIN7安装与配置经典分享

安装准备:

1、卸载之前安装的nodejs版本的额内容,包括环境变量和文件安装路径,用卸载的方式实现;

2、环境变量要注意用户变量的重额 %……/Appdata/\Roaming/npm 删除

3、下载nvm-setup.exe

https://github.com/coreybutler/nvm-windows/releasesicon-default.png?t=M85Bhttp://windows版本

 点击下载:

第一步:安装nodejs版本管理软件 nvm:

1、首先直接双击nvm-setup.exe,直接安装,可以选则自定义目录安装,也可以默认安装,注意自定义容易出错。安装路径默认的是C盘,如果C盘内存不够的话可以安装到D盘,一般我是安装到D盘上。

下一步:

填入nodejs安装的路径

 

 

 next

 点击 :install

 点击完成

2、测试 安装是否成功:

在windows 命令行中:

输入:nvm --version,回车

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>nvm --version

Running version 1.1.9.

Usage:

  nvm arch                     : Show if node is running in 32 or 64 bit mode.
  nvm current                  : Display active version.
  nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for the
                                 most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults
                                 to system arch). Set [arch] to "all" to install 32 AND 64 bit versions.
                                 Add --insecure to the end of this command to bypass SSL validation of the remote download server.
  nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls.
  nvm on                       : Enable node.js version management.
  nvm off                      : Disable node.js version management.
  nvm proxy [url]              : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
                                 Set [url] to "none" to remove the proxy.
  nvm node_mirror [url]        : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url.
  nvm npm_mirror [url]         : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url.
  nvm uninstall <version>      : The version must be a specific version.
  nvm use [version] [arch]     : Switch to use the specified version. Optionally use "latest", "lts", or "newest".
                                 "newest" is the latest installed version. Optionally specify 32/64bit architecture.
                                 nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
  nvm root [path]              : Set the directory where nvm should store different versions of node.js.
                                 If <path> is not set, the current root will be displayed.
  nvm version                  : Displays the current running version of nvm for Windows. Aliased as v.


C:\Users\Administrator>

命令完成可以用。

3、安装nodejs

在命令行中执行:

nvm  ls avaiable   显示所有nodejs的当前可安装版本

4、nvm install 13.14.0      安装 nodejs13.14.0版本,是WINWIN支持的最高版本。

C:\Users\Administrator>nvm install 13.14.0
Downloading node.js version 13.14.0 (64-bit)...
Complete
Creating C:\Users\Administrator\AppData\Roaming\nvm\temp

Downloading npm version 6.14.4... Complete
Installing npm v6.14.4...

Installation complete. If you want to use this version, type

nvm use 13.14.0

5、如果速度比较慢在nvm安装目录可以配置 setting.txt文件中额安装镜像 

 修改文件添加

 node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

两行内容,填写结果settint.txt文件如下:

root: d:\soft\dev\nvm
path: d:\soft\dev\nodejs
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

6、安装好后,在命令行中 使用 nvm use 13.14.0,检查版本  node -v,npm -v

C:\Users\Administrator>nvm use 13.14.0
Now using node v13.14.0 (64-bit)

C:\Users\Administrator>nvm list

  * 13.14.0 (Currently using 64-bit executable)

C:\Users\Administrator>npm --version
6.14.4

C:\Users\Administrator>node -v
v13.14.0

C:\Users\Administrator>

7、配置环境变量

a、在用户变量中增加 node_home = d:\soft\dev\nodejs

 b、在用户变量中增加 node_path =d:\soft\dev\nodejs\node_glabal\node_mouduls

c、在path中增加 %node_path%;%node_home%;

d、在path中增加d:\soft\dev\nodejs\node_global;

8、在nvm目录中增加目录 node_cache,node_global 两个目录

9、在命令行中执行npm设置

a、npm config set prefix "D:\soft\dev\nodejs\node_global"
b、npm config set cache "D:\soft\dev\nodejs\node_cache"

10、测试安装结果,在命令行中安装express 

npm install express -g     # -g是全局安装的意思

在安装目录中存在即可。

 文件存在安装成功。至此打工告成。

附录说明:

A、npm,nvm,node 的区别

node 版本和npm包 兼容性越来越差,不同的node版本对应这不同的npm包版本。在使用node版本的过程中,版本之间的切换越来越重要。nvm是一个很好的node版本管理工具
1,node: node开发环境,代码库
2,npm:  安装node的时候,一起安装的,node的包管理器
3,nvm:  node的版本管理工具

 B、nvm的常用命令:

1 nvm version  查看nvm版本 (常用最新为1.1.9  2022-9-20)   
2 nvm install stable   安装当前最新稳定版 node
3 nvm install <version> ## 安装指定版本  For Example:     nvm install v10.12.0
4 nvm ls-remote 查看远程所有的版本, 如果为 N/A,切换到外网,改变一下指向   export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
5 nvm ls  查看已经下载安装的node版本
6 nvm current   查看当前使用的node 版本
7 nvm use v14.18.1 切换到14.18.1  nod
8 nvm alias default 14.18.1 设置默认node版本e版本

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郑钱王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值