If vue-cli 2.X has been installed on the local COMPUTER, you need to uninstall it first. Open CMD tool, and enter NPM uninstall Vue-cli -g.
NPM install -g@vue /cli;
Vue create project-name (your project name) // The name of the project does not support hump (including capital letters)
(IV) After the successful creation, the project will enter the basic configuration stage; ①Your connection to the default NPM registry seems to be slow. Use registry.npm.taobao.org for faster installation? (Y/n) Y Indicates whether to use Taobao image to speed up the downloading of dependent packages. In this case, Y is generally selected. After this step is set up, the formal project basic configuration phase is entered.
② Ask about configuration mode
My-default — the template I saved previously (with the last project created and configured, and saved the configuration if it was not available for the first project created); Default — use Default Settings (scaffolding Default definitions) Manually select features — custom Settings (this project configuration is now customized) Select custom Settings here
③ Select the configuration to be set
The up and Down keys are used to select the configuration item to be configured. The space bar is used to select the configuration item to be configured. For other functions that are not commonly used, see the prompts and press Enter
④ Ask whether to use the history mode on the router
Hash is not required to request the server, while history is required to request the server, and the server must have a corresponding response, otherwise it will jump to the 404 page. Therefore, N is generally selected.
Select a CSS preprocessor language
This asks you which CSS preprocessor language to choose, and which one to choose according to your actual needs. In this case, SASS. (The difference between Node-sass and Dart-Sass is that node-sass is automatically compiled in real time, while Dart-Sass is saved before it takes effect. Dart-sass is the official release of SASS, and the latest features will be implemented first.
⑥ Automatic code syntax, formatting detection
You can choose what kind of automatic code syntax and formatting detection you want. Select the first item here.
⑦ Select grammar check mode
() Lint and fix on commit // select the first item when checking here
8 Query the location of the configuration file
// In dedicated config files // In package.json // In dedicated config files // In package.json So let’s pick the first one here
⑨ Asks whether the configuration scheme is saved as a template so that you can use the configuration next time.
If you select Y, you will be prompted for the name of this configuration template, which is the first option at the beginning of step 2 above, the name of my template, to start building the project
Select N to start building the project directly
⑩ During project construction, dependencies will be downloaded automatically. This is easier than vue-CLI 2.x, so you don’t need to wait until the project is completed to manually install dependencies.
11. After the project is built, type: CD Your project name (created at the beginning); // Enter the project file; NPM run serve// Start service; Enter local in the browser. The operation succeeds.