Vue-nodeJS environment to build

Node.js
Node.js is based Chrome V8 engine [JavaScript runtime environment]. Node.js uses an event-driven, non-blocking I / O model.
Node.js is a platform to make JavaScript running in the development server, it allows JavaScript to be with PHP, Python, Perl, Ruby and other server-side scripting language on an equal footing

Note 1: Node.js -> JavaScript runtime environment, development languages: JavaScript
the J2EE -> the Java runtime environment, development of language is java
Note 2: Node.js v10.15.3 Document address: http: //nodejs.cn/ api /

npm
npm fact, Node.js package management tool (package manager).

Node.js environment to build
because the platform is Node.js JavaScript code running in the back end, so, you must first install the Node environment in this machine.

Download
Download: https: //nodejs.org/zh-cn/download/
select the appropriate version download, bloggers are using: node-v10.15.3-win-x64.zip

  Note 1: Node There are two versions of the line: LTS is a stable version of the long-term maintenance of Current is a new feature version

Extracting
extract files to the specified location (for example: D: \ initPath), and to establish and node_cache node_global two directories under the directory after extracting

Note 1: New directory Description
node_global: npm global installation location
node_cache: npm cache path

Note 2: This tutorial is to extract the files to D: \ initPath directory, behind all this as an example, the actual development to modify their extract the directory
D: \ initPath \ node-v10.15.3 -win-x64

Configuration environment variable
added NODE_HOME, is: D: \ initPath \ node- v10.15.3-win-x64
modify the PATH and finally adding:;% NODE_HOME%;% NODE_HOME % \ node_global;

Note 1: The environment variable View
echo% node_home%
echo% path%

Note 2: Testing the installation: Open cmd window, the output of the following command output NodeJs and npm version number of
the Node -v
npm -v

Npm global module configuration cache default installation location and path
open cmd, separate run the following command:
npm config cache SET "D: \ initPath \ Node-v10.15.3-win-x64-\ node_cache"
npm config SET prefix "D: \ initPath \ node-v10.15.3-win-x64 \ node_global "

Note 1: the node_global (npm global installation location) to create a step and node_cache (npm cache path) linked npm
Note 2: If you execute the command stuck, you can delete the C : \ users \ username to re-execute \ after .npmrc. (User name: computer for the current user name)
Note 3: "D: \ initPath \ node-v10.15.3-win-x64 \ node_global", double quotation marks can not be less

Modify npm Mirror improve download speed (you can use cnpm or directly --registry, recommended setting --registry)
 --registry
## Taobao set source
npm config the SET Registry https://registry.npm.taobao.org/
## View source, you can see all the source set off
npm config get registry

Note 1: in fact, the contents of this step is to add the following code to the C: \ users \ username \ .npmrc file
registry = https: //registry.npm .taobao.org

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

Note 1: cnpm after the installation is complete, since you can replace npm command cnpm command, and the official npm still use the mirror, cnpm will use domestic mirrored
Note 2: If you want to revert to the original setting, do the following:
npm config the SET Registry https://registry.npmjs.org/

View mirror set Taobao case
npm get registry

View npm global path settings circumstances
## this step just to install a global evaluation module can
npm install webpack -g
after more than ## command is completed, it will generate the following files
% node_home% \ node_global \ node_modules \ webpack
Note: The download process appears warn not control, appears Error, delete the downloaded file fragmentation re-download  

How to Run the downloaded Node.js project
will unzip the downloaded item to the specified directory, in this case is to extract: D: \ temp \ vueproject, behind all this as an example
## 1. Open a command window
cmd

## 2. Switch to the d disk
## 3. enter the specified directory

cd E:\temp\vueproject

Start project
npm run dev

Start complete

 

Guess you like

Origin www.cnblogs.com/omji0030/p/11406886.html
Recommended