Vue Installation and Configuration

Time:2024-2-1

I. Download and Install Vue

Official website download addressDownload | Node.js

Vue Installation and Configuration

Choose the version that suits you, we recommend LTS, Long Term Stable. I chose Windows Installer(.msi) 64-bit.

Once downloaded, double-click on the downloaded installation package.

Vue Installation and Configuration

Click next

Vue Installation and Configuration

Check I accept………… Click next

Vue Installation and Configuration

It is recommended to change the installation directory to the one you want, and then click next (you can create your own installation directory, I have created a directory in advance: E:\Java\nodejs)

Vue Installation and Configuration

There are five options here, which you can read about when you have time, which is that the installation will install some components and npm, and also add environment variables, as explained on the right. Let’s just click next

Vue Installation and Configuration

No need to check the box here, just click next.

Vue Installation and Configuration

install

Vue Installation and Configuration

 finish

Once the installation is complete, check to see if the installation was successful.

Open cmd and enter the following command.

node -v
npm -v

Vue Installation and Configuration

The version number is output to indicate that the installation was successful.

The full catalog after installation:

Vue Installation and Configuration

II. Creating a global installation directory and a cache log directory

In our installation directory, create two folders named node_cache and node_global.

 Vue Installation and Configuration

Open a Dos window and execute the following command to configure npm’s global module directory and cache directory to the two directories we just created.

npm config set prefix “Your installation directory \node_global”

npm config set cache “your installation directory \node_cache”

Vue Installation and Configuration

In order to download the package quickly in the future, modify the source to Taobao mirror. (With the modification here, we don’t need to install cnpm, because cnpm is theNode.js Taobao Mirror Accelerator.(No need to install it once it’s configured here)

npm config set registry https://registry.npm.taobao.org

Check if the npm configuration changes were successful

npm config list

Vue Installation and Configuration

At the same time, we will find an additional file: C:\Users\user name\ under the .npmrc file, can be understood as a record of the current user to modify the information in the configuration file. If you delete this file, then you just modified those parameters are gone, return to the default configuration.

Vue Installation and Configuration

III. Configuring environment variables

During the installation process, two environment variables are automatically configured aEnvironment Variables—User Variables—PathinnerC:\Users\your username\AppData\Roaming\npmThe other one isEnvironment Variables—System Variables—PathinnerSoftware installation directory, we need to add and modify it a bit.

1. Environment Variables—User Variables—Check Path—Click Edit

Vue Installation and Configuration

commander-in-chief (military)C:\Users\your username\AppData\Roaming\npm modify toYour installation directory \node_global

Vue Installation and Configuration

Vue Installation and Configuration

2. Environment Variables—System Variables—New

Variable name: NODE_PATH

Variable value: your installation directory \node_global\node_modules

Note: The node_modules directory here is not there yet, but it will be automatically generated when we install the module into the global directory later.

Vue Installation and Configuration

Remember to add %NODE_PATH% to the system variable — Path

Vue Installation and Configuration

 

Install vue

1. Install vue.js

npm install vue -g

Where -g is global installation, means install to the global global directory, if you do not add -g, the module will be installed to the node_modules folder under the current path, no directory will be created automatically.

If this problem occurs, it is because the current user does not have this permission.

Vue Installation and Configuration

Some methods on the Internet is to delete C \Users\your username\AppData\Roaming\npm went, that is, the default place to go, that we modified in front of the meaningless.

The correct way to open it is to run it as administrator!

Win + s Search for “Command Prompt” and right click to run as administrator.

Vue Installation and Configuration

npm install vue -g

Vue Installation and Configuration

2. Install the webpack template

npm install webpack -g

Vue Installation and Configuration

In addition, on webpack 4x and above, webpack puts all command-related content into webpack-cli, so you also need to install webpack-cli

npm install webpack-cli -g

Vue Installation and Configuration

Type webpack -v. If you can output the version number, it means it’s all installed.

3. Install scaffolding vue-cli

npm install vue-cli -g

Vue Installation and Configuration  

Type vue –version, and being able to output the version number means it’s installed.

4. Install vue-router

npm install vue-router -g

Vue Installation and Configuration

All done we open the node_modules folder in our custom global modules directory and will find the installed modules unified here.

Vue Installation and Configuration

Fourth, my first vue-cli application.

1. Create a project (it is best to cd to the D disk, E disk location, that is, the path of the project, otherwise the project will be newly created in C:\Users\User name\, you can also directly in the desired path of the project to enter the cmd) may be permissions problems, so we are still administrator to run the cmd window.

Vue Installation and Configuration

2. create a vue application based on a webpack template

vue init webpack project name

Vue Installation and Configuration

Operate according to your needs.

  • What is the name of the project? Enter
  • Project description? Enter
  • Author? Enter.
  • Whether or not to install the compiler Enter
  • Whether to install vue-router y enter
  • Whether or not to use ESLint for code checking n Carriage return
  • Whether to install unit testing tools n Enter
  • Unit Test Related n Carriage Return
  • Initialize directly after creation n Enter

Vue Installation and Configuration

Since there is no automatic initialization, we follow the code prompts to manually initialize the

cd myvue
npm run dev

Vue Installation and Configuration

Visit the website: success!

Vue Installation and Configuration

Recommended Today

DML statements in SQL

preamble Previously we have explained DDL statements in SQL statements. Today we will continue with the DML statement of SQL. DML is the Data Manipulation Language.Used to add, delete, and change data operations on the tables in the library.。 1. Add data to the specified field(INSERT) 2. Modify data(UPDATE) 3. Delete data(DELETE) catalogs preamble I. […]