Nodejs study notes --- installation and configuration environment

A mounting step Node.js

      1, corresponding to its own system corresponding to the download version Node.js, Address: https://nodejs.org/zh-cn/
      2, selected from the install directory installation
      3, environment configuration
      4, the test

Second, start the installation

  1, after the download is complete, double-click "  the Node-v8.9.4-x64.msi  ", to start the installation:

  2, click the "Next" button

  3. Select the installation directory, click on the "Next" button

  4, choose to install items, here I choose the default, click on the "Next" button

  5, click on the "Install" button to install

  6, wait for the installation is completed, click "Finish" button to complete the installation

Third, check whether the installation was successful

       Detection node installation is successful? Node -v

       If the reported node is not an internal command error

       If errors are reported, there is no default installed in c drive program Files //

       We need to configure the environment variables

Fourth, the environment configuration

       1, set the environment variable, "My Computer" - Right - "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables"

      A, into the Environment Variables dialog box, the new [NODE_PATH] in [System variables], enter [C: \ SDE \ Node8.9.4 \ node_modules]

      B, and modify the user variable [] in [Path] [C: \ SDE \ Node8.9.4 \ node_global]

Five test

        1, New Folder, enter the command in the folder: npm init  

{
  "name": "qi",
  "version": "1.0.0",
  "description": "\"学习\"",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "" ,
   "License": "ISC" 
} 
// main package is introduced that js file

        2, the new file under index.js

console.log("hello world");

       3, return to directory, new a.js

var ; JQ = the require ( "./ Qi") // method of introducing module

       4. Type the node a.js

 Output: hello world

        

Guess you like

Origin www.cnblogs.com/qirui-/p/11803017.html
Recommended