How to modify npm global installation mode path

php中世界最好的语言
Release: 2018-05-29 17:41:31
Original
1291 people have browsed it

This time I will show you how to modify the npm globalinstallationmode path, what are theprecautionsfor modifying the npm global installation mode path, the following is a practical case, let's take a look .

Before I formally write this article, I have to talk about a little history of blood and tears.

I just learned nodeJS not long ago, and I was wondering why the globally installed module was not found in the 'node installation directory/node_modules'! Later, I carefully looked at the information after the installation was successful, and found out that it was automatically installed on the C drive. Oh my God, the C drive must not be used to store these things, so I went online to Baidu.

Method 1: (Arrived on Baidu, but it doesn’t work for me....)

Open 'nodejs installation directory/node_modules/npm/.npmrc' and modify this file to:

prefix = G:\nodejs\npm_global_modules
Copy after login

Okay, try npm installbootstrap-g. Is it installed in the specified directory?

If this method doesn’t work for you, you can try the second method!

Method 2:

1. OpenNode.jsCommand prompt and execute npm config ls

So you can see clearly...

2. Modify the value of prefix: npm config set prefix *

It’s done~~~

Summary:A simple question, the reason why it was solved For most of the day, it boils down to a question of learning methods. If you encounter such a problem, check the help document npm help install or google to get the answer quickly. (Also, don’t be too resistant to English documents~~)

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use WebPack to configure vue multi-page

How to use the Node.js sandbox environment

The above is the detailed content of How to modify npm global installation mode path. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!