I installed node to the D drive, and I also needed to change the default installation path of the npm global package because I didn't want to take up space on the C drive. The first step is of course to go to the node official website to download the corresponding version and install it to the D drive. First, create a new nodejs folder on the D drive. The installation will not create a folder Download Select your own installation package, and then select D:\nodeJs when installing. After the installation is complete, there is no node in the environment variables at this time, so node and npm cannot be found on the desktop. Open the installation folder and create two new folders Global is used to store globally installed modules, such as Then open the command window in the installed folder and enter the command to change the default installation path of npm npm config set prefix "D:\nodejs\node_global" npm config set cache "D:\nodejs\node_cache"
After modifying the installation path, the next step is to modify the environment variables Right click on the computer -> Properties -> Advanced system settings Create a new variable in the system Add a variable, the variable value is node_modules of node, the variable value opens this folder and double-clicks the address bar above At this time, npm and node can be found on the desktop Enter the following to check whether the version detection is successfully modified Changing the default installation path Find the PATH in the user variables Add the path D:\nodejs\node_global; Remember to separate them with semicolons. Remember to save after adding Then we can install cnpm to test whether the address is installed successfully. npm install -g cnpm --registry=https://registry.npm.taobao.org After the modification is successful, the installation is completed. Under node_global, there will be node_Modes where cnpm can be found. At the same time, enter cnpm -v in the command box to execute correctly Under node_global, there will be node_Modes where you can find cnpm At the same time, enter cnpm -v in the command box to execute correctly Then it's done. This concludes this article about the steps to customize node installation and change the default installation path of npm global modules. For more information about node npm installation path, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Alibaba Cloud OSS access rights configuration (RAM permission control) implementation
>>: Detailed tutorial for downloading and installing mysql8.0.21
This article shares the specific code for writing...
This article shares the specific code of Vue to a...
UPD 2020.2.26 Currently Ubuntu 20.04 LTS has not ...
MySQL master-slave configuration and principle, f...
There are two ways to deploy Angular projects wit...
1. Preparation Install Tomcat on Linux system, us...
Form validation is one of the most commonly used ...
Table of contents 1. Why do we need unit testing?...
Detailed explanation of the role of static variab...
MySQL official website: https://www.mysql.com/dow...
https base port 443. It is used for something cal...
Note 1: The entire background in the above pictur...
Normally, when you run a command in the terminal,...
In the process of Django web development, when wr...
User namespace is a new namespace added in Linux ...