Change the NPM global module and cache default installation location

Source: Internet
Author: User


1. Since I installed node. js with NPM, create the following two directories in the Nodejs folder:


2. Start cmd and execute the following two commands sequentially
NPM config set prefix "Xxx\nodejs\node_global"
NPM config set cache "Xxx\nodejs\node_cache"

3. Set Environment variables:
Node_path = Xxx\node\nodejs
PATH =%node_path%\;%node_path%\node_modules;%node_path%\node_global;

4. Restart the system or restart the Explorer.exe to make the environment variable effective.

5, install the module to try the above settings are effective

NPM Install EXPRESS-G//-G means installing to the global directory, which is the Xxx\nodejs\node_global set above

Test results, make a record

Change the NPM global module and cache default installation location

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.