Table of Contents
1. Install npm
1. Install node.js
2. Change the local library and cache directory
3. Configure the download source address
4. Update npm
5. Add environment variables
2. Download the core library vue.js
1. Install bower
2. Initialize npm
3. Download vue to local
Home Web Front-end Vue.js How to use npm to download vue.js

How to use npm to download vue.js

Nov 23, 2020 am 11:36 AM
npm vue.js

How to use npm to download vue.js: First go to the [node.js] official website to download and install the tool; then install bower; then initialize npm; finally pass "npm install vue -- save" to download vue.

How to use npm to download vue.js

Recommended: "vue tutorial"

The operating environment of this tutorial: windows7 system, Vue2.9.6 version, this method is applicable to all brands of computers.

Use npm to download vue:

1. Install npm

1. Install node.js

npm(Node Package Manager): Package manager under node.js

Go to the node.js official website to download and install the tool. After nodejs is installed, npm will be automatically installed. Enter the following command on the command line to test whether it is installed. If successful, the version number will appear correctly.

1

2

node -v

npm -v

Copy after login

Look at the other two directories: npm and npm-cache under C:\Users\Administrator\AppData\Roaming. The local warehouse of npm runs in the user directory of the system disk c drive (not seen) to npm-cache because it has not been used and the cache directory is generated as soon as it is used), we tried to move these two directories back to D:\nodejs

2. Change the local library and cache directory

First create 2 new folders in the nodejs directory: node_cache and node_global

Then run the following 2 commands

1

2

npm config set prefix "D:\nodejs\node_global"

npm config set cache "D:\nodejs\node_cache"

Copy after login

Look at npm’s local warehouse, enter the following commands and find that the directory has changed :

1

npm list -global

Copy after login
Copy after login

3. Configure the download source address

Enter the following command to configure the Taobao mirror station:

1

npm config set registry=http://registry.npm.taobao.org

Copy after login

Enter the following command to display all configuration information:

1

npm config list

Copy after login

We pay attention to a configuration file C:\Users\Administrator\.npmrc and find that the information just configured is in this file.

4. Update npm

Update npm:

1

npm install npm -g

Copy after login

Check what modules are in global again:

1

npm list -global

Copy after login
Copy after login

5. Add environment variables

Add D:\nodejs\node_global to the environment variable PATH.

2. Download the core library vue.js

1. Install bower

Install bower first: (To install bower, you need to install node.js and git first)

1

npm insall bower -g

Copy after login

After installation, corresponding commands will be added in the node_global directory.

Check the vue version:

1

bower info vue

Copy after login

2. Initialize npm

Initialize npm and guide the creation of a package.json file in the project to save the installation package information:

1

npm init --yes

Copy after login

3. Download vue to local

Enter the project root directory, cnpm install vue --save or -S (cnpm is Taobao npm, if npm changes the download source The address is Taobao source, you can use npm directly instead of cnpm)

1

npm install vue --save

Copy after login

The above is the detailed content of How to use npm to download vue.js. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

In-depth discussion of how vite parses .env files In-depth discussion of how vite parses .env files Jan 24, 2023 am 05:30 AM

When using the Vue framework to develop front-end projects, we will deploy multiple environments when deploying. Often the interface domain names called by development, testing and online environments are different. How can we make the distinction? That is using environment variables and patterns.

Detailed graphic explanation of how to integrate the Ace code editor in a Vue project Detailed graphic explanation of how to integrate the Ace code editor in a Vue project Apr 24, 2023 am 10:52 AM

Ace is an embeddable code editor written in JavaScript. It matches the functionality and performance of native editors like Sublime, Vim, and TextMate. It can be easily embedded into any web page and JavaScript application. Ace is maintained as the main editor for the Cloud9 IDE and is the successor to the Mozilla Skywriter (Bespin) project.

What is the difference between componentization and modularization in vue What is the difference between componentization and modularization in vue Dec 15, 2022 pm 12:54 PM

The difference between componentization and modularization: Modularization is divided from the perspective of code logic; it facilitates code layered development and ensures that the functions of each functional module are consistent. Componentization is planning from the perspective of UI interface; componentization of the front end facilitates the reuse of UI components.

What to do if npm react installation error occurs What to do if npm react installation error occurs Dec 27, 2022 am 11:25 AM

Solution to npm react installation error: 1. Open the "package.json" file in the project and find the dependencies object; 2. Move "react.json" to "devDependencies"; 3. Run "npm audit in the terminal --production" to fix the warning.

Let's talk in depth about reactive() in vue3 Let's talk in depth about reactive() in vue3 Jan 06, 2023 pm 09:21 PM

Foreword: In the development of vue3, reactive provides a method to implement responsive data. This is a frequently used API in daily development. In this article, the author will explore its internal operating mechanism.

Explore how to write unit tests in Vue3 Explore how to write unit tests in Vue3 Apr 25, 2023 pm 07:41 PM

Vue.js has become a very popular framework in front-end development today. As Vue.js continues to evolve, unit testing is becoming more and more important. Today we’ll explore how to write unit tests in Vue.js 3 and provide some best practices and common problems and solutions.

A simple comparison of JSX syntax and template syntax in Vue (analysis of advantages and disadvantages) A simple comparison of JSX syntax and template syntax in Vue (analysis of advantages and disadvantages) Mar 23, 2023 pm 07:53 PM

In Vue.js, developers can use two different syntaxes to create user interfaces: JSX syntax and template syntax. Both syntaxes have their own advantages and disadvantages. Let’s discuss their differences, advantages and disadvantages.

A brief analysis of how vue implements file slicing upload A brief analysis of how vue implements file slicing upload Mar 24, 2023 pm 07:40 PM

In the actual development project process, sometimes it is necessary to upload relatively large files, and then the upload will be relatively slow, so the background may require the front-end to upload file slices. It is very simple. For example, 1 A gigabyte file stream is cut into several small file streams, and then the interface is requested to deliver the small file streams respectively.

See all articles