Home >Web Front-end >JS Tutorial >A little bug about cnpm

A little bug about cnpm

高洛峰
高洛峰Original
2016-11-04 16:24:401350browse

In actual work, after a project is completed, the code often needs to be compressed before going online. Generally, gulp or webpack is used for compression. (My sister uses gulp) Gulp runs in the node environment.

So first, downloaded and installed node.

For convenience, select the binary file package of node and set the environment variables. Then enter node in the command line, "

After installing node, you need to use npm (Node Packaged Modules). npm is foreign and is easily "walled", so cnpm is often used instead.

  Small tips: Baidu cnpm can find the "Taobao npm mirror" Copy the link

Enter in the command line:

   npm install -g cnpm --registry=https://registry.npm.taobao.org

An error message appeared:

A little bug about cnpm

error ~ error. A large piece of English, what to do? ! ! ! ! (This is the screenshot + the original words of the little girl. Ma Dan, you are blind. You have been studying English for so many years. Don’t you know what is said in English?)

No hurry, first use "npm root" to find the root directory.

A little bug about cnpm

Did you see that she installed things on the c drive (well, I won’t complain, I think back then I also uprightly dedicated all the other d, e, and f drives to my movies, TV shows, pop songs, all Everything is installed on the c drive). Therefore, the suspected reason is: node is installed on the c drive. As a system disk, the c drive cannot be easily modified. So it cannot be installed and downloaded. (Don’t ask me why I said it was a suspicion. I was also afraid that I would make a mistake. If I made a mistake, it would be so embarrassing. Is it okay for girls to be shy?)

Solution:

Find the address in the error message.

A little bug about cnpm

Then right click--Properties--Security--enter the following interface:

A little bug about cnpm

Set all permissions inside to "Allow".

After setting, exit. At this point you can see some changes:

A little bug about cnpm

Enter the installation instructions in the command line again

Statement:
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
Previous article:How Gulp compiles sassNext article:How Gulp compiles sass