Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to customize the installation of node to change the default installation path of the npm global module

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "node how to customize the installation to change the default installation path of the npm global module", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "node how to customize the installation to change the default installation path of the npm global module" this article.

After installing node to disk D, you also need to change the default installation path of the npm global package, because you don't want to take up disk C space.

The first step is, of course, to download the corresponding version from node's official website and install it to disk D at the same time. First, create a new nodejs folder on disk D.

The installation will not create its own folder

Download address

Select your own installation package, and then select D:\ nodeJs when installing.

After the installation is completed, there is no node in the environment variable at this time, so node and npm cannot be found on the desktop. Open the installation folder and create 2 new folders, node_cache and node_global.

Global stores globally installed modules, such as npm install vue-g

Then open the command window under the installation folder and enter instructions to change the default installation path of npm

Npm config set prefix "D:\ nodejs\ node_global" npm config set cache "D:\ nodejs\ node_cache"

Tips: here's a pit. Remember the double quotation marks. Don't forget it, or it won't be modified correctly.

After modifying the installation path, next, modify the environment variable

Computer right-click-- "Properties--" Advanced system Settings

Create a new in the system variable

Add a variable, the value of the variable is the node_modules of node, open the folder, and double-click the address bar above

At this point, npm and node can be found on the desktop.

Enter the following to see if the version detection was modified successfully

Change the default installation path

Find the PATH in the user variable

Add the path D:\ nodejs\ node_global

Remember to have a semicolon before and after.

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 of the node_global is completed. There will be a node_Modes in which the cnpm can be found.

At the same time, typing cnpm-v in the command box will execute correctly.

Under Cheng node_global, there will be node_Modes in it to find cnpm.

At the same time, typing cnpm-v in the command box will execute correctly.

The above is all the contents of the article "how to customize the installation of node to change the default installation path of the npm global module". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report