Node. js environment setup tutorial

Source: Internet
Author: User
Tags install node

Node. js environment setup tutorial

Node. js is a JavaScript runtime environment, but in fact it is encapsulated by Google V8 engine. node optimizes some special use cases and provides APIs, to make V8 better run without a browser, the following small series will introduce node for you. js environment setup tutorial

Node. js is an event-driven I/O Server JavaScript environment. Because of its asynchronous non-blocking, simple environment setup, and fast practical application, it is more popular in the next-generation programming development. At the same time, because Node. js is based on JavaScript syntax, when learning Node. js, you can also understand and learn JavaScript syntax to broaden and deepen your understanding of Web Front-end development technology. Currently, Node. js is mainly used to build HTTP Web servers and quickly implement independent server applications. In practical projects, Node. js is more suitable for implementation of some small system services or some functions of some large projects.

1. install any version of node through nvm

If you want to develop a node for a long time, update the node version quickly, or switch the node version quickly, in a non-Windows (such as osx and linux) environment, use nvm to install your node development environment to keep the system clean.

If you use Windows for development, you can use nvmw to replace nvm.

1.1 install nvmw

1.1.1. clone nvmw directly from github to the local machine. Here, I use the H: \ program files (x86) \ directory to store git projects.

Git clone https://github.com/cnpm/nvmw.git

1.1.2. Set the H: \ program files (x86) \ nvmw directory to your PATH environment variable.

1.1.3 re-open your terminal and enter nvmw

1.2 install any version of node through nvmw

To install the latest version, run the following command:

Nvmw install 0.12.4

Problem: If "input error: No file extension. js Script Engine" appears ".

1.3 set the current node version

Run the following command:

Nvmw use 0.12.4

2. Install node through. msi

Go to https://nodejs.org/download/to download the environment installation package. After the download is complete, double-click "node-v0.12.4-x64.msi", start to install nodejs, custom installed under H: \ program files (x86) \ nodejs.

Enter: node-v in the cmd console, and the console will print: v0.12.4. If a version prompt is displayed, the installation is successful. The pilot step will install the node.exe file to the H: \ program files (x86) \ nodejs directory, and add the directory to the PATH environment variable.

3. Test and run js

3.1 Test through command line interaction mode

3.2 run the node command to execute the js File

Edit the HelloWorld. js file and enter console. log ("Hello shapolang961 ");

Run the following command on the command line:

Node HelloWorld. js

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.