Follow me to learn Nodejs (1) node. js introduction and installation development environment

  • 2020-03-30 03:01:55
  • OfStack

Learning materials

1. (link:

2.Node.js development guide

Introduction (only picked up what I thought was important)

      Node.js is a platform for Javascript to run on the server outside the browser, not the language.

      The Javascript engine used by node. js is V8 from Google Chrome. You don't have to worry about Javascript compatibility headaches to run outside the browser

      Single thread, asynchronous IO and event-driven design are adopted to achieve high concurrency (asynchronous events also increase the difficulty of development and debugging to some extent).

      Node.js has an HTTP server built into it, so that's good news for web development.

  < img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 201442014393 ">  

Home page: (link:

English API: (link:

Chinese API: (link:

Installation Node. Js

  Operating system environment: WiN 7 64-bit

Installation in a Windows environment is relatively simple


Download the corresponding operating system installation file from the link (just install the latest version)

Following the prompts, next step until the installation is successful, you can see it in the default installation path (C:\Program Files\nodejs), the default path can be modified during installation.

After successful installation, enter node-v at the command prompt to view the installed version, and the output version is installed successfully

Introduction of NPM

Windows node. js installation package installation contains the Node Pageaged Modules (NPM), this node. js itself has the basic Modules, with this NPM can install rich node. js library to complete the actual development requirements.

      Common commands:

      See the help

      NPM help or NPM h

      Install the module

      NPM intstall < The Module Name>

      Install the module in the global environment (-g: enable global mode)

      NPM install - g < The Module Name>

      More: (link:

      Uninstall the module

      NPM uninstall  < Moudle Name>

      Displays the modules installed in the current directory

      NPM list

After the installation is successful, the NPM and node.js paths are added to the PATH user environment variable and the system environment, respectively

The development tools

  I downloaded a 7.0 version of WebStorm and it seems to work quite a bit

WebStorm download address: (link:

NET development can choose WebMatrix3, download direct installation, easy to operate, do not do too much explanation, with a period of time, you can directly build Nodejs project, if only in the Windows environment development, recommend it

WebMatrix download address: (link:

I ended up with Sublime, which maintains a unified development tool across all platforms, and there are many configuration methods on the web

Sublime does download address: (link:       (the software does not need to be registered, and the window that needs to be registered will pop up from time to time in the process of use, so you can cancel it.)

Sublime node. js development environment configuration

Download and install the node. js installation package before starting the configuration

1. Start by installing Sublime Text 2

2. Run Sublime, find Tools on the menu -> The Build System - > The new Build System

3. Copy in the file

    "cmd": ["node", "$file"],
    "file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
    "selector": "source.javascript"

      4. Save the file as nodejs. sublime-build

5. Find Tools on the menu --> The Build System - > Choose NodeJs

6. Install Package Control; To run Sublime, press the shortcut Ctrl + '; Enter the following in the console and press enter;

import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( '' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 2014420143958 ">   Details please refer to: (1) the link:

7. Restart Sublime after installation, press Ctrl + Shift + P; Enter install, select the install Package, and press enter

< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 2014420144131 ">  

8. Type nodejs and select nodejs installation (JavaScript & nodejs Snippets can be installed)

< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 2014420144343 ">  

      9. Create a new test.js file and type console.log('Hello node.js '); Press Ctrl + B to run, output successfully! The following figure

< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 2014420144424 ">  

< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / 201442014458 ">  

      This is where the Sublime node. js development environment is configured!

If you want to look better the theme of the color scheme, please reference: (link:

Extensions: install multiple version managers

      Install the multi-version manager NVMW (NVM in the Node development guide book, but not on Windows, I found this in

      Install command

      NPM install - g NVMW

      Because did not use it, so do not do much of the introduction, in detail


Related articles: