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 does nodejs change the path

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

Share

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

How to change the path of nodejs, in view of this question, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

The method of nodejs to change the path: 1, create a new folder such as node_global under the installation directory; 2, execute the "npm install gulp-g" command under the cmd window; 3, add a configuration to the user variable of the environment variable configuration.

This article operating environment: windows7 system, nodejs10.16.2 version, Dell G3 computer.

How does nodejs change the path?

Nodejs modifies the global installation path

After installing nodejs, suppose we want to modify the path of the global installation, we can do the following:

1. Create new node_global and node_cache2 folders under the installation directory (this article takes D:\ Program Files\ nodejs as an example).

two。 Execute under the cmd window:

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

Normally, we use commands.

Npm install gulp-g

You can install gulp to node_global, but some people may not, so you can try the following methods:

Under the installation directory (this article takes D:\ Program Files\ nodejs as an example), find the node_modules folder and enter the npm folder to find the npmrc file. Use notepad or other editing tools to open and write:

Prefix=D:\ Program Files\ nodejs\ node_globalcache=D:\ Program Files\ nodejs\ node_cache

Save. The global installation path for ok has been modified.

After modifying the global installation path, there is one more key step that we need to complete.

Without the following steps, we will find a global module gulp installed, but prompt command not found when we enter the command gulp-v. It is said on the Internet that I want to configure a system variable NODE_PATH, but it is still useless after I configure it. It was later found that it was only necessary to add a configuration to the user variable configured in the environment variable. Add D:\ Program Files\ nodejs\ node_global\ to the Path of the user variable so that we can display the version number normally when we enter the command gulp-v

This is the answer to the question about how to change the path of nodejs. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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