当前位置:网站首页>使用nvm管理nodejs(把高版本降级为低版本)
使用nvm管理nodejs(把高版本降级为低版本)
2022-07-01 12:34:00 【Yunlord】
前言
刚开始学习springboot+vue框架,最麻烦的就是配置环境,尤其是网上下的模板所需的版本不一的问题。
为了解决这个问题,今天主要介绍前端vue的环境配置,我们通过nvm管理不同版本的node,实现无缝衔接。
一、nvm、npm、node介绍
1.区别
- nvm:nodejs 版本管理工具,也就是说:一个 nvm 可以管理很多 node 版本和 npm 版本。
- nodejs:在项目开发时的所需要的代码库。
- npm:nodejs 包管理工具,在安装的 nodejs 的时候,npm 也会跟着一起安装,它是包管理工具,npm 管理 nodejs 中的第三方插件。
2.关系
nvm管理nodejs和npm的版本,npm可以管理nodejs的第三方插件。

二、nvm安装步骤
1.卸载之前的node
进入控制面板,打开卸载或更改程序,搜索node.js,找到所安装的node.js并卸载。
2.下载nvm管理工具
从官网下载安装包 https://github.com/coreybutler/nvm-windows/releases,下载红框里面的那个。

3.运行nvm-setup.exe文件
(1)选择“我接受…”那一行,点击next
(2)可以根据自身情况自定义选择路径盘,路径不要出现空格或中文符号
(3)选择node.js的安装位置,可以根据自身情况自定义选择路径盘,路径不要出现空格或中文符号
(4)最后一步,点击install即可安装完成
4.检验是否安装成功
nvm v如果出现版本号,即安装成功(如果安装不成功,查看之前自己安装的node.js有没有删除彻底、安装nvm工过程有没有漏掉什么!)。
5.添加镜像
安装完成之后,我们还要在设置文件里面添加淘宝镜像,这样我们可以选择下载的nodejs版本选择比较多下载速度也快
在nvm的安装路径下面找到setting.txt文件、打开编辑。
在setting.txt文件里面加入:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/三、安装node.js版本
1.查看可用的node.js版本号
nvm list available2.安装不同版本的node
nvm install 14在nvm install后面加上你要安装的版本号就可以直接下载,(例如:nvm install 14)即可安装对应版本以及自动安装对应的npm版本。
3.切换node版本
nvm use 14安装成功后,输入命令行nvm use node版本号(例如:nvm use 14)即可选择你本地所使用的Node.js版本,使用此命令行可以根据你自己的需要随意切换node.js版本运行。
切记:第一次安装好一定要输入这个命令,才能使用node。
4.查看node和npm版本号
node -v
npm -v
参考:
边栏推荐
- Four years after graduation: work, resign, get married, buy a house
- The operation process of using sugar to make a large data visualization screen
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 2
- 手把手教你完成图像分类实战——基于卷积神经网络的图像识别
- Exploration and practice of inress in kubernetes
- List of QT players [easy to understand]
- GID: open vision proposes a comprehensive detection model knowledge distillation | CVPR 2021
- [some notes]
- Eurake partition understanding
- Huawei interview question: Recruitment
猜你喜欢

One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!

"Analysis of 43 cases of MATLAB neural network": Chapter 40 research on prediction of dynamic neural network time series -- implementation of NARX based on MATLAB

Consolidate -c operator

Queue operation---

Stack-------

JS reverse | m3u8 data decryption of a spring and autumn network

How to install php7 and perform performance test using yum

Sort out relevant contents of ansible

MySQL common functions

Circular linked list--
随机推荐
Relationship between accuracy factor (DOP) and covariance in GPS data (reference link)
华为面试题: 招聘
【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
第十四章 信号(四)- 多进程任务示例
Fatal error: execution: there is no such file or directory
MySQL workbench data modeling function
编译调试Net6源码
系统测试UI测试总结与问题(面试)
AI抠图工具
Onenet Internet of things platform - mqtts product equipment connected to the platform
Self organization is the two-way rush of managers and members
二叉树的链式存储
Eurake partition understanding
Machine learning - Data Science Library Day 3 - Notes
【MAUI】为 Label、Image 等控件添加点击事件
Ansible的playbook
手把手教你完成图像分类实战——基于卷积神经网络的图像识别
Sort out relevant contents of ansible
微信小程序 – 80个实用的微信小程序项目实例
System test UI test summary and questions (interview)