Home > Web Front-end > JS Tutorial > Detailed explanation of the steps to modify the built-in configuration path of Nodejs

Detailed explanation of the steps to modify the built-in configuration path of Nodejs

php中世界最好的语言
Release: 2018-05-21 15:30:58
Original
2740 people have browsed it

This time I will give you a detailed explanation of the steps to modify the built-in configuration path of Nodejs. What are the precautions for modifying the built-in configuration path of Nodejs? The following is a practical case, let's take a look.

The built-in npm of Nodejs will install the module by default in the user AppData directory of the c drive (complain: I don’t understand why current software likes to install resources here)

C drive is so small, it will definitely not work. Let’s modify it step by step to D drive

1. Open the cmd command line and check Current configuration

Enter npm config ls

First look at the current npm configuration environment. Since I have modified it, I can see the modified path

2. Modify the path

You need to modify two paths here, modulepath and cache path

module corresponds to prefix

cache corresponds to cache

First create two directories on other disks

D:\nodejs\node_modules\npm\node_global_modules
D:\nodejs\node_modules\npm\node_cache
Copy after login

Then execute them in sequence

npm config set prefix"D:\nodejs\node_modules\npm\node_global_modules"
npm config set cache"D:\nodejs\node_modules\npm\node_cache"
Copy after login

3. Modify the environment Variables

Newly added Environment variable NODE_HOME

Modify Path and add %NODE_HOME%\;%NODE_HOME%\node_modules;%NODE_HOME%\node_modules\npm\node_global_modules\;

4. Test it

Reopen a cmd command line and try to install a plug-in

Execute

npm install cordova -g// -g means to install it globally Directory

After the installation is completed, open the set installation path to see if it is successful

I believe you have mastered the method after reading the case in this article. Please come for more exciting information. Pay attention to other related articles on php Chinese website!

Recommended reading:

Detailed explanation of how to use the jQuery class name selector (.class)

vue introduces small js numbers Detailed explanation of keyboard steps

The above is the detailed content of Detailed explanation of the steps to modify the built-in configuration path of Nodejs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template