An error occurred during the npm install -g @vue/cli step. The steps are as follows:
1. Download node.js first
I don’t know if it is downloaded, you can enter it in cmd
node -v
If the version number appears, the computer already has node.js. If not, go to the official website to download it. Other friends on csdn have given download methods.
2. Open the search box in the start bar through win+s, enter cmd, and run as administrator
Paste the following sentence in the cmd interface. Because the download is slow, the npm Taobao image is configured. If it is not too slow, you can directly proceed to the next step of global installation.
npm config set registry http://registry.npm.taobao.org
Install @vue/cli globally:
npm install -g @vue/cli
Change to the directory where you want to create the project
For example, I am in ↓
c:xx\system 32:(这里乱写的,不用管)
Add this sentence after, that is, in the vue-test file of vscode on drive d
cd /d D:\vscode\vue-test
Then create the project using the command:
vue create vue-test
If you don't know how, just paste everything else in except for the sentence c:xx\system 32: (it's written randomly here, don't worry about it) .
Then it's done, select the vue2 option
After entering, open it and enter cmd at this location.
After entering, enter this sentence and press Enter
npm run serve
When this happens, it's over.