Nodejs installation and Environment configuration under win system

Source: Internet
Author: User

First step: Download the installation file
Download Nodejs, official website: http://nodejs.org/download/,

Chinese web http://nodejs.cn/

Step Two: Install Nodejs

After the download is complete, double-click "Node-v4.4.4-x64.msi" to begin installing Nodejs, which is installed by default under C:\Program Files (x86) \nodejs.

In the cmd console input: node-v, the console will print out: v4.4.4, the version prompt indicates that the installation was successful. This boot step installs the Node.exe file into the C:\Program files (x86) \nodejs directory, and adds the directory to the system PATH environment variable.

Step Three: NPM installation
The new version of Nodejs has been integrated with NPM, so NPM is also installed. Use the cmd command line to enter "Npm-v" to test whether the installation was successful. For example, a version prompt indicates that the installation was successful.
Enter the Nodejs installation directory C:\Program Files (x86) \nodejs

Type the command: CD C:\Program Files (x86) \nodejs can be

Configuring the path of the global module of NPM and the path of the cache, it is best to put the above two folders in the Nodejs home directory, so that node. JS multi-version management;

Create a "Node_global" and "Node_cache" two folders under Nodejs. We'll just type two lines of command in CMD:

NPM config set prefix "C:\Program Files (x86) \nodejs\node_global"

NPM config set cache "C:\Program Files (x86) \nodejs\node_cache"

Set System variables (very important). Go to my Computer → properties → advanced → environment variables. Create a new "Node_path" under System variables and enter "C:\Program Files (x86) \nodejs\node_global\node_modules"

Fourth step: Install the relevant environment (CMD must be run as Administrator)

NPM Install Jade-g
NPM Install Mysql-g

By default, the above components are installed under the Node_path path.

Fifth Step: Install Coffeescript

NPM Install Coffee-script-g

Confirm the installation of the command: COFFEE-V, the version number that appears indicates a successful installation.

Sixth step: Coffeescript Test Example
To create a new Cs.js file, enter:

var http =require ("http");

Http.createserver (function (request,response) {

Response.writehead (200,{"Content-type": "Text/plain"});

Response.Write ("HelloWorld");

Response.End ();

}). Listen (8888);

Console.log ("Nodejs Start listen 8888 port!");

Run the "coffee cs.js" output in this directory:

D:\>node Cs.js

The above environment is basically configured to complete.

Additional notes:
All commands are globally installed by-G, so that the installation packages are installed under the current user and can be accessed in all other areas of the disk, in comparison. Otherwise, it is installed in the current directory and can only be used in the current directory.

Installing the Express issue
After installing the NODEJS installation package, after installing Express via NPM, running Express Prompt "Express" is not an internal or external command because of a version issue,

The current version is 4.0.0, changed to 3.5.0 to run. NPM install-g [email protected]

Baidu out of Reason 4.0 version of the command tool will be separated from the version, the need to reinstall the tool

NPM install-g Express-generator

Nodejs installation and Environment configuration under win system

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.