Articles sparked by Node.js and npm and cnpm

The question before posting is: I want to use vue-cli, check the npm version number and install cnpm, but there is a problem with installing vue-cli with cnpm.

First, run node -v in cmd, my own version is 12, npm -v; then install cnpm Taobao image accelerator:

npm intsall cnpm -g

Here I want to install vue-cli scaffolding, using cnpm Install vue-cli -g fails:

I patched things together on the Internet and found out that either the node version is low or the cnpm version is high . I choose to solve the former;

Command npm cache clean -f to clear the npm cache, and then go to npm install -gn to install, (if this is wrong, force it: npm install -gn --force)

 

 From the step of updating the node version, there are system differences. The commands mentioned on the Internet can be used to update n latest or n stable, and they are suitable for Linux systems; . .

I found the answer from the netizen Windows , which is as follows:

1. Check where the node is on the blackboard: where node

2. Go to the official website of node to download the latest version or the stable one, follow its upgrade and install, you need to pay attention to the same installation path as in the first step, the main thing is to cover it~

3. When it’s done, go to the command line and run node -v to check whether the installation is successful

4. Follow the first requirement: cnpm install vue-cli -g

 

Guess you like

Origin blog.csdn.net/SlinaW/article/details/127810941