[前端工具] 使用 nvm-windows 管理 Node 及 Vue 环境
nvm-windows
一个针对Windows平台的Node.js版本管理工具,是用Go语言编写的。
项目地址:https://gitcode.com/gh_mirrors/nv/nvm-windows
·

最近需要使用 Vite 及 Vue3 来开发项目,需要升级我本地的 Node V12版本,但基于本地 Node 版本已经开发了许多其他项目,直接升级会出现各种兼容性bug,于是便使用 nvm 来进行 Node 版本的管理,nvm 同时支持 Linux、Windows、Mac。
我这里以 Windows 环境为例,记录使用 nvm 进行 Node 版本及 Vue 的管理(React 及其他同理)。
nvm 安装
注意:安装前需要先卸载本地 Node 环境!!!
nvm 下载地址:http://nvm.uihtm.com/,选择自己的平台进行下载。
- 点击安装文件进入安装

- 根据提示进行下一步

- 选择 nvm 安装环境

安装路径任意指定,但需要注意的是安装目录名不要带中文或其他特殊字符。 - 选择 Node 安装环境

- 最后进行安装

- 在命令行中输入
nvm检查是否安装成功
nvm 进行 Node 及 Vue管理
- 找到 nvm 安装目录下的 settings.txt 文件,更换配置源

在文件中添加
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/

2. 在命令行输入 nvm install 版本号 进行安装
- 使用
nvm ls查看已经安装的所有 Node 版本
其中带 * 的项即为当前使用版本,同时可以在安装目录下看到已经安装的所有 Node 环境
- 使用
nvm use 版本号使用指定 Node 版本
- 使用 use 命令后,在当前 Node 环境进行脚手架安装,我这里以 Vue 为例,其他框架及包安装同理

这里其实就和正常情况下的安装一样了,比如 yarn、webpack 等的安装。如果使用 npm 安装较慢的话,可以配置淘宝镜像源
npm config set registry http://registry.npm.taobao.org/
- 需要在另一 Node 环境中搭建项目环境时,再使用
nvm use 版本号进行切换,然后进行其他操作 - 如果不需要某个 Node 的话,可以使用
nvm uninstall 版本号进行卸载
一个针对Windows平台的Node.js版本管理工具,是用Go语言编写的。
最近提交(Master分支:4 个月前 )
862ef44d
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)
---
updated-dependencies:
- dependency-name: actions/github-script
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 年前
2d3757a9
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)
---
updated-dependencies:
- dependency-name: softprops/action-gh-release
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)