当前位置:网站首页>Nodejs installation and environment configuration
Nodejs installation and environment configuration
2022-04-23 16:47:00 【Hair loss programmer】
1、 Download and install
Enter official website , Choose according to your computer system and number of digits , I choose windows64 position .msi Format installation package
.msi and .zip Format difference :
.msi yes Windows installer Developed program installation file , It allows you to install , modify , Uninstall the program you installed . To put it bluntly .msi Namely Windows installer Data packets of , Encapsulate all the content related to the installation files in one package .
.zip It's a compressed package , After decompression, you can , No installation required

When the download is complete , Double click Install Package , Start installation , Always point next that will do , The default installation path is C:\Program Files Next , You can also customize it


npm package manager Express npm Package manager
online documentation shortcuts Online document shortcuts
Add to PATH add to node Install path to environment variable
The installation is complete as shown in the figure , Here I modified node Installation path for C:\node

After installation ,.msi The format of the installation package has node.exe Add to system environment variable path in , If you download .zip Format , Because there is no installation process , So you need to manually node.exe Add the directory to the environment variable path in , See system variable validation

Now that we have node Add to global system variables , We can go straight to CMD Anywhere in the window node, open CMD window , Carry out orders node -v see node edition
$ node -v
v14.7.0
the latest version node At the time of installation, it also installed npm, perform npm -v see npm edition
$ npm -v
6.14.13
2、 Modify the global dependency package download path
By default , We're executing npm install -g XXXX When downloading the global package , The default location of this package is C:\Users\ user name \AppData\Roaming\npm\node_modules Next , Can pass CMD Instructions npm root -g see
C:\Users\liaijie\AppData\Roaming\npm\node_modules
It is recommended to set the storage location by yourself , Because if you put it in C disc , Will make the system disk space smaller , System disk resources are very important .
npm config set prefix "C:\node\node_global"
npm config set cache "C:\node\node_cache"
Or open c:\node\node_modules\npm.npmrc file , Revised as follows :
prefix =C:\node\node_global
cache = C:\node\node_cache
The above operation shows , Modify the global package download directory to C:\node\node_global, The cache directory is C:\node\node_cache, And automatically create node_global Catalog , and node_cache A directory is a cache directory , It will be created automatically when you download the global package

3、 Configure environment variables
Because we modified the download path of the global package , So naturally , The global package we download will be stored in c:\node\node_global\node_modules, And the corresponding cmd The instructions will be stored in c:\node\node_global
I install a package globally
npm install xxx
After installation , To execute the corresponding instructions , Likely prompt :
'xxx' Not an internal or external command , It's not a runnable program
Or batch files .
That's because when we execute instructions , It will default to node Find the command file in the installation root directory , Here it is xxx.cmd, And then there will be node Install... In the root directory node_modules Find the dependent package folder under , Here it is @xxx Folder , Because we modified the global package storage path , So of course I can't find it , So we need to add the global package storage path we specified to the system environment variable , So you can find

therefore Path There are two configurations in total
- C:\node\
- C:\node\node_global
4. Switch npm Mirror source
Switch the source of package download through the following command , Because the default source is slow , Switch to the source of Taobao in China , Can greatly improve this problem .
npm config set registry http://registry.npm.taobao.org
版权声明
本文为[Hair loss programmer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231400278212.html
边栏推荐
- NVIDIA graphics card driver error
- Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
- PostgreSQL列存与行存
- On the security of key passing and digital signature
- 漫画:什么是IaaS、PaaS、SaaS?
- Encapsulating the logging module
- Talk about browser cache control
- MySql主从复制
- On the value, breaking and harvest of NFT project
- 100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
猜你喜欢

Installation and management procedures

博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生

How to choose the wireless gooseneck anchor microphone and handheld microphone scheme

昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案

loggie 源码分析 source file 模块主干分析

NVIDIA显卡驱动报错

LVM与磁盘配额

无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择

ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation

Cartoon: what are IAAs, PAAS, SaaS?
随机推荐
深度学习100例 | 第41天-卷积神经网络(CNN):UrbanSound8K音频分类(语音识别)
How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
计组 | 【七 输入/输出系统】知识点与例题
logback的配置文件加载顺序
PHP高效读大文件处理数据
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
深入了解3D模型相关知识(建模、材质贴图、UV、法线),置换贴图、凹凸贴图与法线贴图的区别
Cartoon: what are IAAs, PAAS, SaaS?
vim编辑器的实时操作
如何建立 TikTok用户信任并拉动粉丝增长
Encapsulating the logging module
MySql主从复制
Mock test
Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
Nodejs reads the local JSON file through require. Unexpected token / in JSON at position appears
New project of OMNeT learning
Deepinv20 installation MariaDB
vscode如何比较两个文件的异同