Node.js installation and configuration

1. Download address

  • nodejs.cn/download/

  • Enter CMD: node -v to check whether the node is installed and the version

2. Environment variables

(1) Check whether node is configured as an environment variable

Enter path in CMD

(2) Windows configuration environment variables

  • Right-click [My computer] — [Properties] — [Advanced System Settings] — [Environment variables] — system Variables] — [Path]

3. Install taobao image CNPM

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

4. Automatically restart the tool

cnpm install -g nodemon

Install webPack

npm install webpack -save -dev

Iii. Vue scaffolding construction

1. Install the vue – cli

npm install -g vue-cli

2. Build new projects with WebPack

Vue Init Webpack project name

3. Go to the project folder

CD project name

4. Install dependencies

npm install

  • An error was reported after installation
NPM WARN [email protected] requires a peer of AJV @^5.0.0 but none is installed. You must install peer dependencies yourself.Copy the code
  • The dependency AJV is not installed and needs to be installed manually
npm install ajv
Copy the code

5. Install vue-Router and Vue-Resource.

cnpm install vue-router vue-resource --save

6. Start the project

npm run dev

7. Configuration file

  • Config /index.js for some basic properties (we can change these configurations according to our own needs)

  • Build /utils.js is used to generate CSS loaders and style loaders

  • Build /vue-loader.conf.js Basic configuration of vue-loader

  • Build/weback base. Conf. Public js dev and prod environment configuration

  • Build/weboack. Dev. Conf. Js dev environment configuration

  • Build/webpack. Prod. Conf. Jsprod basic configuration of the environment

  • Build /check-versions.js Checks the VERSIONS of NPM and Node

  • Build/build js build project

  • Configuration file code reading | resources: segmentfault.com/a/119000001…