当前位置:网站首页>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 .
边栏推荐
- mysql可以定时导出表格吗?
- gin 路由,参数,输出
- ECCV 2022 lightweight model frame Parc net press apple mobilevit code and paper Download
- Flink real-time warehouse DWD layer (order placing multiple tables to realize join operation) template code
- 作业7.28 文件IO与标准IO
- Summary of OCR optical character recognition methods
- Connecting PHP 7.4 to Oracle configuration on Windows
- Nodejs安装教程
- Kubernetes (V) -- deploy kubernetes dashboard
- Unity发送Post请求给GoLang服务端解析并返回
猜你喜欢

Operator3-设计一个operator

约瑟夫环问题

Leetcode 879. profit plan

最新百亿量化私募名单

H3C_利用设置缺省静态路由优先级实现出口双线路的主备功能

Vmware16 create virtual machine: cannot create a new virtual machine, do not have permission to perform this operation

Decompilation of wechat applet

接口测试实战项目03:执行测试用例

数组的子集不能累加出的最小正数

Improved pillar with fine grained feature for 3D object detection paper notes
随机推荐
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
WPF 界面布局必知基础
对Vintage分析的一些学习理解
Some tips of vim text editor
20-40K| 梅卡曼德3D视觉算法/软件/产品经理招聘
Unity sends a post request to the golang server for parsing and returning
Flink实时仓库-DWD层(下单-多张表实现join操作)模板代码
mysql可以定时导出表格吗?
Vagrant box cluster processing
HJ37 统计每个月兔子的总数 斐波那契数列
win11系统错误:由于找不到 iertutil.dll,无法继续执行代码。重新安装程序可能会解决此问题
建木持续集成平台v2.5.2发布
JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?
接口测试实战项目03:执行测试用例
如何使用gs_expansion扩展节点
谷歌零碎笔记之JWT(草稿)
最新百亿量化私募名单
[cf1054h] epic Revolution -- number theory, convolution, arbitrary modulus NTT
NPM install reports an error NPM err could not resolve dependency NPM err peer
暑期总结(二)