The following two ways to introduce Windows install Node.js and Frame Express
The first way:
A total of four steps to easily complete Nodejs Express installation
First step, install
All to press Express-generatorFirst, otherwise when the project is created, the Express command is not found
NPM install-g express-generator #需先安装express-generator
npm install-g Express
express-v #验证是否安装成功
Step two, create the project
$ Express Myfirstexpress # Express default template with Jade, if you need Ejs template support, plus the-e option, that is, EXPRESS-E myfirstexpress
$ cd myfirstexpress< c11/>$ ls
Step three, run the project
Copy Code code as follows:
$ NPM Install #需要等待一段时间 because you need to get a lot of library files
$ NPM Start
Step fourth, visit the first Express project
Input in Browser http://127.0.0.1:3000
The second method (text description combined with picture):
Mainly through the following five steps to complete NODEJS Express installation
Step One: Install the Express module, CD to the folder, using NPM Install Express command to install Express module, you will find the folder more Node_modules directory, there will be express module.
Step two : Go to any folder, execute the Express app command, and create an app application project that is structured as follows
E:\nodejs\express_demo>express app
create:app
Create:app/package.json
& nbsp; create:app/app.js
create:app/public
create:app/bin
cr Eate:app/bin/www
create:app/public/stylesheets
create:app/public/stylesheets/ Style.css
create:app/views
create:app/views/index.jade
Create:app /views/layout.jade
create:app/views/error.jade
create:app/public/images
create:app/routes
create:app/routes/index.js
create:app/routes/users . JS
create:app/public/javascripts
Install dependencies: (this indicates the installation Essentials package)
$ cd App && npm install
run the app: (here instructions are executed, using NPM start)
&nbs p; $ debug=app./bin/www
Step three : The CD goes into the app folder, executes the app, and uses the command node app to make an error, because the first time you use the Express framework, there are not many necessary modules
Error:
module.js:340
throw err;
^
Error:cannot Find module ' serve-favicon '//indicates missing Serve-favicon module
At Function.module._resolvefilename (module.js:338:15)
At Function.module._load (module.js:280:25)
At Module.require (module.js:364:17)
At require (MODULE.JS:380:17)
At object.<anonymous> (E:\nodejs\Node.js Liao backward 戝 疄 鎴 Enokiya Chapter_two\express_dem
O\APP\APP.JS:3:15)
At Module._compile (module.js:456:26)
At Object.module._extensions. JS (module.js:474:10)
At Module.load (module.js:356:32)
At Function.module._load (module.js:312:12)
At Function.Module.runMain (module.js:497:10)
Fourth Step: this time according to the hint, installs the essential modules to be possible, as the figure
Your environment has been set up for using Node.js 0.10.26 (IA32) and NPM.
C:\users\administrator>e:
E:\>CD Nodejs
E:\NODEJS>NPM Install Serve-favicon
serve-favicon@2.2.0 Node_modules\serve-favicon
├──ms@0.7.0
├──parseurl@1.3.0
├──fresh@0.2.4
└──etag@1.5.1 (crc@3.2.1)
E:\NODEJS>NPM Install Morgan
morgan@1.5.1 Node_modules\morgan
├──basic-auth@1.0.0
├──depd@1.0.0
├──debug@2.1.1 (ms@0.6.2)
└──on-finished@2.2.0 (ee-first@1.1.0)
E:\NODEJS>NPM Install Cookie-parser
cookie-parser@1.3.3 Node_modules\cookie-parser
└──cookie-signature@1.0.5
E:\NODEJS>NPM Install Body-parser
body-parser@1.12.0 Node_modules\body-parser
├──content-type@1.0.1
├──raw-body@1.3.3
├──bytes@1.0.0
├──depd@1.0.0
├──qs@2.3.3
├──iconv-lite@0.4.7
├──on-finished@2.2.0 (ee-first@1.1.0)
├──debug@2.1.1 (ms@0.6.2)
└──type-is@1.6.0 (media-typer@0.3.0, mime-types@2.0.9)
E:\nodejs>
Step Fifth: after installing all the necessary modules, execute the app, the project root under the NPM Start command, and continue installing the necessary modules if prompted similar to the Error:cannot find module ' Jade ' ERROR
Sixth step: after all of the above is completed, in the browser input http://127.0.0.1:3000/, the following diagram indicates success.
Above is Windows installs the Nodejs and the frame express all content, hoped everybody likes.