Home > Web Front-end > JS Tutorial > How to build a vue.js development environment

How to build a vue.js development environment

清浅
Release: 2020-09-10 13:18:41
Original
6096 people have browsed it

Building the vue.js development environment: first install [vue.js]; then install the npm package manager, modules, webpack and vue scaffolding respectively; finally start to initialize the Vue environment and install project dependencies, go to Vue here The development environment is set up.

How to build a vue.js development environment

[Recommended tutorial: Vue.js tutorial]

Environment preparation

Node.js Javascript runtime environment

npm Package management tool under Node.js

webpack front-end resource modular management and packaging tool

vue-cli scaffolding construction tool

cnpm npm’s Taobao mirror

Vue.js installation

1. The installation of Node.js is very easy. First download the version of the operating system you need from the official website, and then continue to the next step.
After the installation is completed, type node -v on the command line. If the corresponding version number appears, the installation is successful.

How to build a vue.js development environment

2. npm is a package management tool installed along with Node.js. You can check whether the installation is successful by typing npm -v directly on the command line.

How to build a vue.js development environment

Although the npm package manager is available, because the server address of the package that npm download needs to depend on is abroad, access to many resources will be very slow. So we can install Taobao’s domestic mirror.
3. Type npm install -g cnpm --registry=http://registry.npm.taobao.org on the command line.
In this way, you can use the cnpm command to install the module:

cnpm install [name]
Copy after login

4. Install webpack

cnpm install webpack -g
Copy after login

5. Install vue scaffolding

npm install vue-cli -g
Copy after login

Initialize a Vue .js environment

Create a new folder on your computer to store our code. Then use the command line to enter the cd directory path of this folder.
After that, use the command

vue init webpack name
Copy after login

to initialize a vue environment. This command means to initialize a project, in which webpack is the build tool, that is, the entire project is based on webpack. There will be some initialization settings during the installation process. We can use the default configuration and press Enter all the way.

How to build a vue.js development environment

We can also see from the picture above that vue very thoughtfully told us the command to quickly start (To get started)

Installation Project dependencies

must be installed from the official warehouse. The npm server is abroad, so the installation speed of this step will be very slow.

npm install
Copy after login

Do not install from the domestic mirror cnpm (it will result in missing many dependent libraries later)

cnpm install
Copy after login

Install the vue routing module vue-router and the network request module vue-resource

cnpm install vue-router vue-resource --save
Copy after login

Start the project

npm run dev
Copy after login

After successful operation, he will tell you the ip and port number

How to build a vue.js development environment

##Visit this address

How to build a vue.js development environment

If the above picture appears. Congratulations, you are ready to start your Vue.js journey.

The above is the detailed content of How to build a vue.js development environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template