Nodejs Environment Configuration

Source: Internet
Author: User

*

1, download path
https://nodejs.org/en/download/

2, install Express (previously with NPM Install-g Express, has been prompted to error, and then check the data said Nodejs if it is more than 4,
should use Express-generator)

D:\RESOURCES\NODEJS\NODEJS>NPM Uninstall-g Express
NPM WARN Uninstall not installed in D:\Resources\NODEJS\nodejs\node_modules: "Express"

D:\RESOURCES\NODEJS\NODEJS>NPM install-g Express-generator
D:\Resources\NODEJS\nodejs\express-D:\Resources\NODEJS\nodejs\node_modules\express-generator\bin\express
[Email protected] D:\Resources\NODEJS\nodejs\node_modules\express-generator
├──[email protected]
├──[email protected] ([email protected])
└──[email protected] ([email protected])

D:\resources\nodejs\nodejs>express-v
4.13.4

Create a HelloWorld Project
D:\resources\nodejs\nodejs>express HelloWorld

Create:helloworld
Create:helloworld/package.json
Create:helloworld/app.js
Create:helloworld/public/javascripts
Create:helloworld/public/images
Create:helloworld/public/stylesheets
Create:helloworld/public/stylesheets/style.css
Create:helloworld/routes
Create:helloworld/routes/index.js
Create:helloworld/routes/users.js
Create:helloworld/public
Create:helloworld/views
Create:helloworld/views/index.jade
Create:helloworld/views/layout.jade
Create:helloworld/views/error.jade
Create:helloworld/bin
Create:helloworld/bin/www

helloworld.js//////
var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain"});
Response.Write ("Hello World");
Response.End ();
}). Listen (8888);
Console.log ("Nodejs Start listen 8888 port!");

****************

D:\RESOURCES\NODEJS\NODEJS>CD HelloWorld

D:\resources\nodejs\nodejs\helloworld>node Helloworld.js
Nodejs Start Listen 8888 port!


Open Address http://127.0.0.1:8888/
Discovery Output:
Hello World

From

*****************
1,cmd window, input node, enter, enter "Console.log (" Hello "), you can simply test node. js

*

Nodejs Environment Configuration

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.