当前位置:网站首页>Download, install and use NVM of node, and related use of node and NRM
Download, install and use NVM of node, and related use of node and NRM
2022-07-06 05:40:00 【zhuangwei_ eight thousand two hundred and fifty-six】
This article mainly introduces the relationship between these three , And their respective applications .
Attach the address as usual :
node
node, It mainly uses one npm Package management tools , It's also useful node Write background applications , This article mainly introduces node Of npm;
About what is npm Package management tools , I believe nothing is more authoritative than official documents , So about npm What's your introduction , Please check by yourself node Of npm Official documents
well , Get into the subject .
About node Installation , I believe most of them have no problem , It's all goofy installation ( Just click on the next step all the way )
It is worth noting that :

We're entering node When downloading the address , The choice is this Long term maintenance version , Don't choose the latest version , The long-term maintenance version is relatively stable , It is also recommended by the government to choose the long-term maintenance version ;
Download normally node After installing the package , Direct installation . I won't say much here .
nrm
installed node, after window + r Input cmd

Get into ‘ Black window ’ Enter the command :node --version View installed node edition

See the displayed version number , Express node Installation successful ;
So what is nrm?
nrm It's a npm Network speed management tool , because npm By default, all downloads are through foreign websites , So we need to install another nrm Network speed management tool to switch the image source to improve our npm Download speed :
npm i nrm -g
Test for successful installation , Enter the following command on the command line to verify the version number , If the version number appears, the installation is successful :
nrm --version
Then use nrm Check which image source has a faster network speed ( It will take a while to test ), Enter the following command at the command line :
nrm test
After a while, the command line displays :

In front of you * Represents the image source you are currently using ;
explain :taobao Our servers are in China , Therefore, it is faster to download and use the image source , Here I have switched ;
How to switch the image source :
nrm use Name of the image source
// Example
nrm use taobao
in addition , You can also use cnpm Download tools to download , Function and npm It's the same ;
// Global installation cnpm
npm install cnpm -g
Whether to use cnpm Installation tools ,IT Opinions vary in the world , I won't say much here .
nvm
I don't know if you found out after joining the company , Used in previous projects of the company node Version and existing node The versions are quite different , It may lead to the use of a new version node Unable to start and run the old project of the packaging company normally ;
that ,nvm coming , What is? nvm?nvm(node version management) node version management , seeing the name of a thing one thinks of its function ,nvm It's actually a management node Version of a tool , With this tool , We can install multiple node edition , You can switch the desired one according to different items at will node edition ;
After entering the website of the download address , One thing to note is not to use the latest version :

To download the maintenance version :

After decompression, click the installation package to install :

This is nvm Installation path for ;

This is nvm Corresponding node route , Note here that if you installed node, Also hope that before node Version for this nvm Words of management , This node The path needs to be the same as the previous node The path is the same ;

Click Next here , If it was installed before node , Will prompt : Detected that node xx.xx.xx, you hope nvm Control this version ?

Click is , Then the normal installation succeeds :

testing nvm Is the installation successful :

Next , adopt nvm Install different versions of node:
nvm install 16.15.1

Install one more :
nvm install 14.4.0

View installed node list
nvm list
// perhaps
nvm ls

Then switch to normal use node Just use version ,
nvm use 14.4.0
And then use npm command , It turned out that the report was wrong :npm Not an internal command ……

That's because the top passes nvm install node 14.4.0 At version time Installed npm Wrong report !!!

Check it out. nvm Path folder :



Results found ,node 16.15.1 There are npm command ,node 14.4.0 Of them, there is no :
Solution 1 :
direct nvm Download the file again node Version can ;Solution 2 :
Go to npm Mirror website Download the corresponding version , Unzip to node_modules And changed his name to npm, Go to this folder , take bin In the folder npm、npm.cmd、npx、npx.cmd Copy the four files to the corresponding node Version folder ;
I do not know! node The version corresponds to npm How many versions can you check :node Previous versions
After that , It is suggested that nvm Of the installation path ofsettings.txtAdd to file : This step is mainly to npm Change the image to Taobao's image , Can increase the download speed . It can also be done through nvm Command to set these addresses , At the end of the article, there is an introduction to the relevant commands , There will be no demonstration here .
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

Prepare it later nvm Common commands :
nvm list: View the installed node editionnvm ls: List all node editionnvm version: View the current nvm editionnvm install <version>: Install the specified node editionnvm use <version>: Switch to use the specified node editionnvm uninstall <version>: Uninstall the specified node editionnvm current: Displays the current node editionnvm alias <name> <version>: To different node Add an alias to the version numbernvm unalias <name>: Delete the defined aliasnvm on: open nodejs controlnvm off: close nodejs controlnvm proxy: View settings and agentsnvm node_mirror [url]: Set or view setting.txt Medium node_mirror, If not set, the default is https://nodejs.org/dist/nvm npm_mirror [url]: Set or view setting.txt Medium npm_mirror, If not set, the default is : https://github.com/npm/npm/archive/.nvm use [version] [arch]: Switch the settings node Version and number of digitsnvm root [path]: Set up and view root route
边栏推荐
- First acquaintance with CDN
- 04. 项目博客之日志
- 清除浮动的方式
- Rustdesk builds its own remote desktop relay server
- Game push: image / table /cv/nlp, multi-threaded start!
- What is independent IP and how about independent IP host?
- How to get list length
- Vulhub vulnerability recurrence 69_ Tiki Wiki
- Jvxetable implant j-popup with slot
- Huawei od computer test question 2
猜你喜欢

指针经典笔试题

01. 开发博客项目之项目介绍

js Array 列表 实战使用总结

Unity Vector3. Use and calculation principle of reflect
【SQL server速成之路】——身份验证及建立和管理用户账户
![[Jiudu OJ 08] simple search x](/img/a7/12a00c5d1db2deb064ff5f2e83dc58.jpg)
[Jiudu OJ 08] simple search x

Fluent implements a loadingbutton with loading animation

The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?

Vulhub vulnerability recurrence 69_ Tiki Wiki

Remember an error in MySQL: the user specified as a definer ('mysql.infoschema '@' localhost ') does not exist
随机推荐
Notes, continuation, escape and other symbols
How to use PHP string query function
Redis message queue
04. Project blog log
[SQL Server Express Way] - authentification et création et gestion de comptes utilisateurs
Note the various data set acquisition methods of jvxetable
[JVM] [Chapter 17] [garbage collector]
Jushan database appears again in the gold fair to jointly build a new era of digital economy
Vulhub vulnerability recurrence 72_ uWSGI
Auto.js学习笔记17:基础监听事件和UI简单的点击事件操作
LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
2022 half year summary
LeetCode_字符串反转_简单_557. 反转字符串中的单词 III
Text classification still stays at Bert? The dual contrast learning framework is too strong
【云原生】3.1 Kubernetes平台安装KubeSpher
2022半年总结
Web Security (VI) the use of session and the difference between session and cookie
进程和线程
Codeforces Round #804 (Div. 2) Editorial(A-B)
What preparations should be made for website server migration?