Detailed Description: Vue uses the command line to build a single page application, and detailed description of vue command line construction
Use command lines to build a single page application
Let's take a look at the final result:
Outline
1. Download node, git, npm
2. Use command line to install a project
1. Download Tool
You can download node and git on the official website.
The following describes how to install npm. npm is only available when both of the above are installed.
Domestic direct git npm is very slow, so we will download and install the image address under the taobao npm image>
Open the installed git bash
1. Enter the image address in Git Bash:
After the download is successful, enter cnpm-v to check whether the installation is successful.
2. After npm is installed, go back to the official Vue website and use the command line to install npm.
Follow the steps above to install: (if npm is used, change it to cnpm)
1. Global installation of vue-cli $ cnpm install-g vue-cli
2. Create a "webpack"-based template project $ vue init webpack my-pro
There will be a series of problems:
3. Install the dependency $ cd my-pro and switch to the my-pro directory you just created.
4. Enter $ cnpm install to download the dependent node_module module. You can see that the node dependency module has been downloaded under the directory.
5. Finally, enter cnpm run dev.
Since a project was created at the beginning and port 8080 of node was occupied, the following error is reported,
A simple and crude method is to close the current node process:
The most, the most, and the last step:
Next let's open http: // localhost: 8080. Finally, it succeeded !!!
PS: record some commands
1. $ cnpm install -- global vue-cli
2. $ vue init webpack-simple demo
3. $ cd demo/
4. $ cnpm install
5. $ npm run dev
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.