Detailed explanation of node.js installation and HbuilderX configuration

Detailed explanation of node.js installation and HbuilderX configuration

npm installation tutorial:

1. Download the Node.js installation package

Official website: https://nodejs.org/en/

2. Before using, let's first understand what these three things are used for.

webpack: Its main purpose is to prepare all static resources that need to be released on the browser side through CommonJS syntax, such as merging and packaging resources.

vue-cli: User-generated Vue project template. (Help you quickly start a Vue project, that is, give you a set of Vue structures, including basic dependency libraries, which can be installed with just npm install)

insert image description here

As shown in the figure, the version downloaded now is 14.16.0 LTS (recommended for users now):

insert image description here

Double-click to install

1. First, we can see that the default path is C drive. Here we take D drive as an example for installation: d:\node.js

insert image description here
insert image description here

Click Next all the way

insert image description here

Click Finish

insert image description here

Next we win + r shortcut key

insert image description here

We enter echo %PATH%

insert image description here

We enter node -v and npm -v

insert image description here

Let's take a look at C:\Users\Administrator\AppData\Roaming

insert image description here

We can see that npm's local repository is running in the user directory of the system disk C drive (npm-cache is not seen because it has not been used. The cache directory is generated as soon as it is used). We try to move these two directories back to D:\nodejs

First create two directories as shown below

insert image description here

Then run the following 2 commands

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

As shown below, let's take a look at the local repository of npm and enter the command npm list -global

insert image description here

Enter the command npm config set registry=http://registry.npm.taobao.org to configure the mirror site

insert image description here

Enter the command npm config list to display all configuration information. Let’s focus on one configuration file.

insert image description here

C:\Users\Administrator.npmrc

insert image description here

Using txt text or a text editor, we can see the configuration information just now:

insert image description here

Check if the mirror station works. Command 1

npm config get registry 

insert image description here

Check if the mirror station is OK Command 2
Npm info vue to see if you can get information about vue

insert image description here
insert image description here
insert image description here

Note that at this time, the default module D:\nodejs\node_modules directory will be changed to D:\nodejs\node_global\node_modules directory.
If you run commands such as npm install directly, an error will be reported.
We need to do 1 thing:

1. Add the environment variable NODE_PATH. The content is: D:\nodejs\node_global\node_modules

insert image description here

(Note that the following operations require you to reopen CMD for the above environment variables to take effect)

1. Test NPM installation of vue.js

Command: npm install vue -g
The -g here means installing to the global directory

insert image description here

Let's take a look: D:\nodejs\node_global\node_modules\vue

insert image description here

2. Test NPM installation of vue-router

Command: npm install vue-router -g

insert image description here
insert image description here

Run npm install vue-cli -g to install the Vue scaffolding

insert image description here
insert image description here
insert image description here

Add D:\nodejs\node_global to the path environment variable
For versions below Windows 10, the PATH is displayed horizontally. Please note that there should be no semicolon [;] when adding it to the end.

insert image description here

Reopen CMD and test whether Vue is working properly

insert image description here

Note that the vue-cli tool has built-in templates including webpack and webpack-simple. The former is for more complex and professional projects.
His configuration is not all placed in webpack.config.js in the root directory.

Initialization, installation dependencies:
When installing, select install vue-router? Yes and all others are No

insert image description here

Run npm install to install dependencies

insert image description here

Run npm run dev
Enter npm run dev in the dos command

insert image description here

Open http://localhost:8080 in your browser as prompted.

insert image description here

Automatically open the browser http://localhost:8080/#/

Enter in the DOS command: npm run build

Generate static files and open the newly generated index.html file in the dist folder

insert image description here

Next, we will use the Hbuilderx tool to configure Node.js and npm

Official website: https://www.dcloud.io/hbuilderx.htmlHubilderX link

insert image description here

insert image description here

insert image description here

Enter npm run dev in the terminal to run the project

This is the end of this article about node.js installation and HbuilderX configuration. For more relevant node.js HbuilderX configuration content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • In-depth analysis of Node.js single-threaded model
  • Understanding what Node.js is is so easy
  • Specific use of node.js global variables
  • The whole process of node.js using express to automatically build the project
  • Node.js sends emails based on STMP protocol and EWS protocol
  • Node.js file copying, folder creation and other related operations
  • Detailed explanation of asynchronous generators and asynchronous iterations in Node.js
  • Detailed explanation of the steps to create a web server with node.js
  • How to collect and parse command line arguments in Node.js
  • Detailed explanation of Alibaba Node.js technical documentation process module learning guide
  • Complete steps to develop cli using node.js
  • How to connect MySQL to Node.js through Sequelize
  • How to install the latest version of Node.js on CentOS 8.2 server
  • How to remove the BOM header of Node.js text file
  • Appium+python automated configuration (adk, jdk, node.js)
  • How to convert a callback in Node.js to a Promise
  • Node.js path module, get the file suffix operation
  • First experience with node.js crawler framework node-crawler
  • Nodejs Exploration: In-depth understanding of the principle of single-threaded high concurrency

<<:  Install two MySQL5.6.35 databases under win10

>>:  VSCode configuration Git method steps

Recommend

How to dynamically modify the replication filter in mysql

MySQL dynamically modify replication filters Let ...

Vue3 list interface data display details

Table of contents 1. List interface display examp...

Detailed tutorial on installing Python 3 virtual environment in Ubuntu 20.04

The following are all performed on my virtual mac...

Sharing some details about MySQL indexes

A few days ago, a colleague asked me a question a...

Implementing countdown effect with javascript

Use Javascript to achieve the countdown effect, f...

VMware Workstation installation Linux (Ubuntu) system

For those who don't know how to install the s...

Detailed explanation of Vue life cycle functions

Table of contents Lifecycle Functions Common life...

Mysql 5.6 adds a method to modify username and password

Log in to MySQL first shell> mysql --user=root...

An article to help you learn CSS3 picture borders

Using the CSS3 border-image property, you can set...

How to install MySQL Community Server 5.6.39

This article records the detailed tutorial of MyS...

Detailed explanation of the use of vue-resource interceptors

Preface Interceptor In some modern front-end fram...

Docker cleaning killer/Docker overlay file takes up too much disk space

[Looking at all the migration files on the Intern...