当前位置:网站首页>How to build a node development environment efficiently
How to build a node development environment efficiently
2022-07-24 10:28:00 【remiliko】
One 、 Catalog
1. node.js Version control
2. npm Agency control
Two 、node.js Version control
1. Background introduction
With the update and iteration of development , node.js The version of has accumulated quite a lot . For direct development learning , Choose the most stable version directly , That's all right. . But in a real development environment , Sometimes because of the project node Different versions , Leading to some strange adaptation problems , Therefore, different versions of node.js Environment to develop . Recommended here nvm To achieve the right node.js Unified version control , So as to realize fast node.js Version switch .

( nvm management node edition )
2. Installation and basic use
nvm Installation address https://github.com/coreybutler/nvm-windows/releases
Download the .zip After the document , Just unzip and install .
After installation , stay cmd( Console window ) Input nvm version, If the corresponding version number pops up , Indicates successful installation .
3. Basic use
adopt nvm list available The command can see the currently installable node Version number , And then through nvm install + The corresponding version number It can complete the corresponding node Installation of version environment , Re pass nvm list The command can view the installed node.js Environmental Science , as well as nvm use + Corresponding version number The command can quickly switch to the corresponding version .
4. nvm Commonly used instructions
- nvm list available View all currently available node Version?
- nvm install version Download the corresponding version of node Running environment
- nvm list List all currently installed node Running environment
- nvm useversion Choose to use node Running environment
5. install nvm Common questions
q1: Permission problems : Use nvm Report permission problems
a1: Can be cmd The window switches to In administrator mode cmd window
q2: Console scrambling : Use nvm In the process of , cmd Windows may have coding problems
a3: Use chcp 65001 Switch coding environment , that will do .
3、 ... and 、 npm Agency control
It's done nvm Installation , That's basically true node.js Basic control of version environment .node.js The successful installation of also means the completion of npm Installation .npm yes node Centralized package management tool , It can easily and quickly manage third-party packages .
1. npm Common instructions are as follows (| Means to choose any one )
- npm init Initialization file directory , Generate corresponding package.js file
- npm (install | uninstall | update) packageName -g install | uninstall | to update (-g Represents a global installation )
- npm install packageName --save (-dev | -D) Install in development mode
- npm info packageName version View the version details corresponding to the package
- npm install [email protected] Install the specified version of the package
- npm outdated Check whether the currently installed package is expired
- npm list List the currently installed packages
- npm config get registry View the current agent configuration
notes : take Of the above instructions npm Replace with npx after , The reference system can be changed from global node_modules Move to node_modules
2. npm Network problems
Having finished the common instructions , We should talk npm Common problems , npm The most common problem is network problem . Usually because of the network , It's easy to see npm Failed to install the third-party package . This is because npm The downloaded default server is deployed abroad , There will inevitably be some special problems , Therefore, we can avoid network problems by configuring the corresponding proxy image , But it is also a waste of time to remember the mirrored URL path in particular , Therefore, it is recommended to pass nrm To manage the agent platform ( This pattern is somewhat similar to nvm Control and control node edition )
install nrm —— nrm npm i nrm -g
similarly , stay cmd Window type nrm --version, If the corresponding version number is displayed , Represents a successful installation .
3. nrm Basic use of
adopt nrm ls Instructions can see which proxy image servers are currently supported , And then use nrm use + The corresponding image alias You can change it to npm Download destination path , The last is to use nrm test You can directly see which image agent's network condition is better ( notes : nrm test When , There will be one in front of the image you are currently using "*" Icon )
4. nrm Commonly used instructions
- nrm ls List the currently available images
- nrm use Mirror alias Switch to this alias
- nrm test Test connection speed | At the same time, you can see which version you are currently focusing on
It is worth mentioning that , Want to solve npm Download network problems . You can also use yarn and cnpm wait , But because they are related to npm The difference between downloading is equivalent to the feeling of Baidu cloud disk and Xunlei , And there are many related tutorials online , So I won't go into details here ......
边栏推荐
- js函数调用下载文件链接
- Set up mail server with dynamic ip+mdaemon
- pom文件dependency中的 scope用法
- Figure model 2-2022-5-13
- Jenkins deploys the project and prompts that the module package defined by him cannot be found
- [recommendation system] the classic technical architecture of the data flow of the recommendation system + the most complete evolution map of the top 10 deep learning CTR models of Microsoft, Alibaba,
- PyTorch 常用 Tricks 总结
- 图像处理:浮点数转定点数
- Notes on using setupproxy
- What does resource pooling and resource pooling mean?
猜你喜欢

Simply use golang SQLC to generate MySQL query code

《nlp入门+实战:第二章:pytorch的入门使用 》

火山引擎:开放字节跳动同款AI基建,一套系统解决多重训练任务

OSPF含特殊区域实验,MGRE构建和重发布

Dynamic planning: robbing families and houses

Image processing: rgb565 to rgb888

CMS vulnerability recurrence - foreground arbitrary user password modification vulnerability

Sentinel implements the persistence of pull pattern rules

Sentinel 实现 pull 模式规则持久化

给你的网站加一个爱发电角标
随机推荐
PostgreSQL rounding
Curse of knowledge
Tree array-
Looting (leetcode-198)
Erlang学习番外
fatal: unable to commit credential store: Device or resource busy
NiO knowledge points
Association Rules -- July 10, 2022
2022, enterprise unified process platform design and integration specifications refer to thubierv0.1
zoj-Swordfish-2022-5-6
[recommendation system] the classic technical architecture of the data flow of the recommendation system + the most complete evolution map of the top 10 deep learning CTR models of Microsoft, Alibaba,
The best time to buy and sell stocks (leetcode-121)
SQL Server 2012 download and installation detailed tutorial
ZOJ 2770 differential restraint system -- 2 -- May 20, 2022
How many indexes are associated indexes under MySQL InnoDB?
第五章 修改实现(IMPL)类
Add a love power logo to your website
二叉树、二叉树排序树的实现及遍历
Query about operating system security patch information
MySQL - lock