当前位置:网站首页>Nodejs installation tutorial
Nodejs installation tutorial
2022-07-29 07:15:00 【m0_ sixty-seven million three hundred and ninety-four thousand 】
Catalog
One 、 Installation environment
3、 ... and 、 Verify the installation
Four 、 Modify the global module download path ?
5、 ... and 、 Replace npm Source: Taobao image
6、 ... and 、 Global installation of Taobao based cnpm
One 、 Installation environment
The environment demonstrated in this tutorial :win 10 64 position
node.js Download the official website :nodejs Official website .
Click the selected icon to download to the local computer .

Two 、 Installation steps
1、 Double click Install Package , Keep clicking next .
2、 Click on change Button , Change to your designated installation position , Click next ( It is also possible not to change the default location ).
3、 Keep clicking next , Finally, the installation is successful .
3、 ... and 、 Verify the installation
1、 Press on the keyboard 【win+R】 key , Input cmd, And then go back , Open the command line interface

2、 Enter the command prompt window , Input the following commands respectively , Display version number , Installation succeeded , Pictured .
node -v Show installed nodejs edition
npm -v Show installed npm edition 
Four 、 Modify the global module download path
1、 I want to put the full module path and cache path in me node.js Installation folder , In my installation folder 【D:Nodejs】 Next create two folders 【node_global】 And 【node_cache】 Here's the picture :

After creating two empty folders , Same as before , Press on the keyboard 【win+R】 key , Input cmd, And then go back , Open the command line interface , Enter the following command , Pictured .
explain :
prefix = Created node_global Folder path
cache = Created node_cache Folder path
-------------------------------------------------------------------------------
npm config set prefix “D:Coding_toolsNodejs ode_global”
npm config set cache “D:Coding_toolsNodejs ode_cache”

2、 Modify system environment variables
take 【 User variables 】 Under the 【Path】 It is amended as follows 【D:Nodejs ode_global】, Then click OK .

stay 【 System variables 】 Under the new 【NODE_PATH】【D:Nodejs ode_global ode_modules】

stay 【 System variables 】 Under the 【Path】 New add node Global folder 【D:Nodejs ode_global】, Then click OK .

Go through the above steps ,nodejs The downloaded modules will be automatically downloaded to our customized directory , Let's test it . Enter the following command :
npm install express -g # -g Global installation , No addition -g It is downloaded to the current directory by default
Pictured , Download successful , Let's go back to the directory we defined to see .

You can see , Download the express Modules and successfully downloaded to the global specified directory .

** notes :** If you execute the command npm install express -g The following error occurred

Because of permission , Right click Nodejs Folder -> attribute -> Security , Click edit , All permissions can be .

5、 ... and 、 Replace npm Source: Taobao image
explain :npm default registry , That is to download npm The package is downloaded from a foreign server , It's very slow in China , It usually points to Taobao https://registry.npm.taobao.org.
1、 Look at the initial npm Source , Pictured :
npm config get registry

2、 Change the image to Taobao image
npm config set registry https://registry.npm.taobao.org/
3、 Check if the configuration is successful
npm config get registry
6、 ... and 、 Global installation of Taobao based cnpm
explain : because npm Our servers are overseas , So the access speed is slow , The visit is not stable ,cnpm The server is provided by the Taobao team The server is in China cnpm yes npm Mirror image , Generally, it will update synchronously , The difference is 10 minute , therefore cnpm There are advantages when installing some software . But in general cnpm For installation only , So we still use... When creating and uninstalling projects npm.
1、 Global installation of Taobao based cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
2、 After downloading , We can see it locally cnpm modular

3、 Execute the command to view cnpm Is the installation successful
cnpm -v
Pictured , I.e. on behalf of cnpm Environment configuration successful .

summary
I made this detailed tutorial , Just to avoid everyone stepping on the pit like me . Follow the tutorial , Step by step , It will definitely succeed in the end , Remember to like collection .
边栏推荐
- Leetcode 879. profit plan
- 太空射击第17课: Game Over (結束)
- Flink实时仓库-DWD层(kafka-关联mysql的lookup join)模板代码
- 数组的子集能否累加出K
- 暑期总结(二)
- Pod基本介绍
- Homebrew brew update doesn't respond for a long time (or stuck in updating homebrew...)
- JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?
- [redis] redis development specifications and precautions
- Kubernetes (V) -- deploy kubernetes dashboard
猜你喜欢
随机推荐
npm install报错npm ERR Could not resolve dependency npm ERR peer
Thread - thread safety - thread optimization
使用VsCode配置MySQL实现连接、查询、等功能
1172. 餐盘栈 有序列表+栈
[C language brush leetcode] 1054. Bar code with equal distance (m)
Flink real-time warehouse DWD layer (order placing multiple tables to realize join operation) template code
我的个人网站不让接入微信登录,于是我做了这个
DM data guard cluster setup
Is online legend software testing training really so black hearted? Are they all scams?
LeetCode 879. 盈利计划
1172. The plate stack has a sequence table + stack
Interface test actual project 03: execute test cases
MySQL 高级(进阶) SQL 语句 (一)
MySQL queries are case sensitive
pytest合集(7)— 参数化
Student status management system based on C language design
fillder使用
同步/异步、阻塞/非阻塞 与 IO
【charles日常问题】开启charles,使用不了钉钉
微服务远程调用








