Vue build scaffolding (vue-cli) and create a Vue project

1. Install node.js

Vue scaffolding is dependent on Node.js, and if too Node, then there is no need first to install Node.js official website for installation on.

After installation is complete, open the cmd window, enter the node -v and npm -v to view node.js and npm version, if we can show this publication, indicating that the installation has been successful.

 

 2. Install Taobao mirror --cnpm

Since the node download third-party dependencies are downloaded from servers abroad, although no walls, but the download speed is very slow and there may be an exception.

Therefore, in order to improve efficiency, we can replace the mirror source npm Taobao mirror source.

asl install -g cnpm --registry = https: //registry.npm.taobao.org

After the installation is complete, enter cnpm -v, cnpm can view the current version, release notes can be displayed if the installation was successful.

Once complete, you can use cnpm command instead of npm commands.

 

 3. Construction scaffolding installation tool vue-cli

 Global command line installation:

cnpm install -g vue-cli

After the installation is complete, enter vue -V to view the version, if successful, displays the version number, description has been successfully installed, note vue -V in uppercase letters V.

 

4. Create a new project vue

After installing vue-cli success by cd into the folder you want to place the project in the command prompt window to perform create vue-cli project:

vue init webpack myproject

Where "myproject" is the project name for the project you take.

Then the prompts initialization settings and install.

 The installation is completed as follows

 At this point you will create a new folder in myproject project of vue, the following is the file structure within the new project.

 

5. Run the project

To run the project must be dependent on the project,

Use the following command to install dependent.

cnpm install

The installation is completed as follows:

 Finally, you can run the project:

npm run dev

 启动成功后,在浏览器中打开地址:http://localhost:8080,就可以看到我们的搭建好的Vue项目了。

 

 

 

Guess you like

Origin www.cnblogs.com/zzh0318/p/11979397.html