Creating a project with vue-cli4
First check the version number. If low, then you should first uninstall the original, and then install the new one.
npm uninstall -g vue-cli
npm install -g @vue/cli
If the download speed is very slow, you configure a mirrored Taobao
npm config set registry https://registry.npm.taobao.org
Check whether success
npm config get registry
We began to create a new project after the installation is complete,
If there is an error vue: driver's license can not file xxxxxxxx, since the prohibition to run a script on the system again ......
Here is the system prompt prohibit running script, then we open the command line twice permissions to run PowerShell as an administrator
Run after entering:
1. Perform: get-ExecutionPolicy, reply Restricted, it indicates the state is prohibited
2. Perform: set-ExecutionPolicy RemoteSigned can be.
Create a project :
vue create XXXXX
Here, let you choose a preset value. The first default, the second custom configuration, where we choose the second one.
Spacebar to select you need. Enter to confirm.
Ask your routing mode. It is not a history mode. When history will not show the above URL patterns #. But it requires the server configuration. N. election
Select css preprocessor
Select ESLint Code validation rules, providing a plug of javascript code detection tool, ESLint + Prettier use more
Choose when to check the code. Here, I chose the first one, to save time on checking.
Where to put these files again. Let alone, or are put package.json again, you happy enough.
Whether to save settings presets for future projects.
Began to create, and here I created one, I already have it terminated. Directory structure is as follows:
Before you can see the comparison, less build and config directory, configuration if you need to modify the configuration, you can create a new vue.config.js file in the root directory of the project to cover the project.
https://cli.vuejs.org/zh/config/#%E5%85%A8%E5%B1%80-cli-%E9%85%8D%E7%BD%AE configuration reference official website.