Nodejs Getting Started---nodejs detailed installation steps __js

Source: Internet
Author: User
What is Nodejs?
Scripting languages require a parser to run, JavaScript is a scripting language, there is a different parser in various places, such as writing HTML to the JS language, the browser is its parser role. For Js,nodejs, which needs to run independently, it is a parser.

Each parser is a running environment, not only allows JS to define a variety of data structures, carry out a variety of calculations, but also allows JS to use the environment to allow the built-in objects and methods to do something. If the purpose of JS running in the browser is to manipulate the DOM, the browser provides built-in objects such as document. and run in Nodejs in the use of JS is to operate disk files or set up an HTTP server, Nodejs on the corresponding provision of fs,http and other built-in objects.
What to do.
Nodejs's author says he created Nodejs to implement a high-performance Web server, and he first valued the superiority of the event mechanism and the asynchronous IO model, rather than JS. But he needs to choose a programming language to implement his ideas, a programming language that does not have IO capabilities, and that requires good support for event mechanisms. JS does not have its own IO function, is naturally used to deal with the DOM events in the browser, and has a large group of programmers, so it becomes a natural choice.

As he wished, Nodejs was active on the server side, and a large number of NODEJS Web services emerged. On the other hand, Nodejs let the front-end as an artifact, and finally can let their ability to cover the scope out of the browser window, a larger number of front-end tools springing up.

Therefore, for the front-end, although not everyone should take Nodejs to write a server program, but simple to use the command interaction mode debugging JS Code snippets, complex to write tools to enhance efficiency.

How to install (because it is a rookie, only step by step)

Node.js Official installation package and source code download address: https://nodejs.org/en/download/

Installation Environment: Windows7 x64
Installation steps:
Step 1: Double-click the download installation package "Node-v0.12.0-x64.msi" to display the Welcome interface as follows:

Step 2: Click Next, display the Node.js License Agreement page, and then modify the installation path (not modified with the default or can)

Step 3: Here I direct default next next, ready to install:

Step 4: After the confirmation is correct, click Install, start the installation, and then until the installation is complete, click Finish.

Step 5: Configure the Environment variables: By default, Node.js is installed, the Node.exe directory path is automatically configured in the system's PATH environment variable, but you may be able to enter a Node prompt error under DOS command after you install it.
Open the System environment variable, found that it has been configured, but DOS run "set path" and can not see the configuration of Nodejs, that is the problem of personality. Reboot the computer to reload it. You can also delete the automatic configuration, manually plus can be. Such as: Turn on computer Properties-Advanced system settings-environment variables, locate the path variable in the system variables list:

Step 5: Detect if the installation was successful:
Click Start-run-cmd (win+r), open dos, enter "Node–v", "Npm–v" Check Node.js version:

Step 6: Test:
After configuration, install a module test, we will install the most commonly used express module, open the cmd window,
Enter the following command for global installation of the module:

Step 7: Use your own local project
Doc commands go to the root of your project, then execute "npm install", and then "Node App.js" (This is my local JS file, replace it with your local project)

The figure 3000 represents your port number. The local access address is localhost:3000.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.