What is VUe-CLI

Vue official scaffolding tools. Scaffolding tools simply automatically configure the environment, dependencies, and other information required by the project.

2. Install vuE-CLI globally

(1) Check the NPM version. You are advised to install the NPM to the latest version.

[Command line view version number] node -v NPM -vCopy the code

(Optional) NPM install -g NPM

NPM config set registry “registry.npm.taobao.org”

(2) Installation

NPM install webpack -g NPM install webpack webpack-cli -g NPM install webpack webpack-cli -g vue -VCopy the code

Note:

Parsing: Unexpected end of JSON input while parsing near Parsing: NPM cache clean –force

3. Create project (command line)

(1) Create a file save path. Such as: E: \ vue \ vue – demo

CD E:\vue\vue-demo [download template] vue init webpack vue-demo [enter the interactive page, choose according to your own situation]? Project name vue-demo # Project name, enter the default name in parentheses (Sorry, name can no longer contain capital letters) ? Project description A vue. js Project # Author # name of Author? Vue Build standalone # Runtime + Compiler: recommended for most users? Install vue-router? Yes # Do you need vue-router? Use ESLint to lint your code? Yes # Whether to use ESLint as the code specification. Pick an ESLint lint related to the same ESLint Standard #? Set up unit tests Yes Pick a test runner? Setup e2e tests with Nightwatch? Install option # e2E test? Should we run `npm install` for you after the project has been created? (recommended) NPM # Package manager, I chose NPMCopy the code

(2) After the installation is successful, enter the project directory

CD E:\vue\vue-demo [initialize project] NPM install [start project, start project according to package.json] NPM run dev [close project] Ctrl + C http://localhost:8080/ [Project package and go online] NPM run build copy the files in the dist directory generated after package to the corresponding address of the server (such as tomcat webapps directory).Copy the code

Enter http://localhost:8080/#/ in your browser