安装4.x版本的express开发框架
错误版本(未更新前的安装方法,更新后就不是这么安装了,好多网上的教程还是这种方法,所以这里先写明了,旧版这里是可以通过的,但是新版4.x就不行了,请用分割线下边的方法)
Step 1、确认服务器有nodejs编译及依赖相关软件,如果没有可通过运行以下命令安装。
[root@BobServerStation local]# yum -y install gcc gcc-c++ openssl-devel
[root@BobServerStation local]# wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
[root@BobServerStation node-v0.10.24]# ./configure --prefix=/usr/local/node
[root@BobServerStation node-v0.10.24]# vim /etc/profile
[root@BobServerStation node-v0.10.24]# node -v
v0.10.24
[root@BobServerStation node-v0.10.24]# node
> console.log(”Hello NodeJS, I'm Bob.Z“);
Hello NodeJS, I'm Bob.Z
undefined
>
[root@BobServerStation local]# npm install express -g
[root@BobServerStation local]# express DemoApp
[root@BobServerStation local]# cd DemoApp
[root@BobServerStation DemoApp]#
[root@BobServerStation local]# cd DemoApp
[root@BobServerStation DemoApp]# npm install
[root@BobServerStation DemoApp]# node app
Express server listening on port 3000
Express
Welcome to Express

在官网找到了解决方法是 express 4需要通过 下面的命令安装
npm install -g express-generator
- [root@localhost nodejs]# npm install -g express-generator
- /root/git/nvm/versions/node/v4.2.1/bin/express ->/root/git/nvm/versions/node/v4.2.1/lib/node_modules/express-generator/bin/express
- express-generator@4.13./root/git/nvm/versions/node/v4.2.1/lib/node_modules/express-generator
- ├── sorted-object@1.0.
- ├── mkdirp@0.5.(minimist@0.0.)
- └── commander@2.7.(graceful-readlink@1.0.)
- [root@localhost DemoApp]# express -V
- 4.13.
- [root@localhost DemoApp]# express -h
- Usage: express [options][dir]
- Options:
- -h,--help output usage information
- -V,--version output the version number
- -e,--ejs add ejs engine support (defaults to jade)
- --hbs add handlebars engine support
- -H,--hogan add hogan.js engine support
- -c,--css <engine> add stylesheet <engine> support (less|stylus|compass|sass)(defaults to plain css)
- --git add .gitignore
- -f,--force force on non-empty directory
- [root@localhost nodejs]# express DemoApp
- create :DemoApp
- create :DemoApp/package.json
- create :DemoApp/app.js
- create :DemoApp/public
- create :DemoApp/public/javascripts
- create :DemoApp/public/images
- create :DemoApp/public/stylesheets
- create :DemoApp/public/stylesheets/style.css
- create :DemoApp/routes
- create :DemoApp/routes/index.js
- create :DemoApp/routes/users.js
- create :DemoApp/views
- create :DemoApp/views/index.jade
- create :DemoApp/views/layout.jade
- create :DemoApp/views/error.jade
- create :DemoApp/bin
- create :DemoApp/bin/www
- install dependencies:
- $ cd DemoApp&& npm install
- run the app:
- $ DEBUG=DemoApp:* npm start
- [root@localhost nodejs]#cd DemoApp/&& npm install
- cookie-parser@1.3. node_modules/cookie-parser
- ├── cookie@0.1.
- └── cookie-signature@1.0.
- debug@2.2. node_modules/debug
- └── ms@0.7.
- serve-favicon@2.3. node_modules/serve-favicon
- ├── etag@1.7.
- ├── fresh@0.3.
- ├── ms@0.7.
- └── parseurl@1.3.
- morgan@1.6. node_modules/morgan
- ├── on-headers@1.0.
- ├── basic-auth@1.0.
- ├── depd@1.0.
- └── on-finished@2.3.(ee-first@1.1.)
- express@4.13. node_modules/express
- ├── escape-html@1.0.
- ├── merge-descriptors@1.0.
- ├── cookie@0.1.
- ├── array-flatten@1.1.
- ├── cookie-signature@1.0.
- ├── utils-merge@1.0.
- ├── content-type@1.0.
- ├── methods@1.1.
- ├── vary@1.0.
- ├── etag@1.7.
- ├── path-to-regexp@0.1.
- ├── serve-static@1.10.
- ├── range-parser@1.0.
- ├── content-disposition@0.5.
- ├── fresh@0.3.
- ├── parseurl@1.3.
- ├── depd@1.0.
- ├── qs@4.0.
- ├── proxy-addr@1.0.(forwarded@0.1., ipaddr.js@1.0.)
- ├── finalhandler@0.4.(unpipe@1.0.)
- ├── on-finished@2.3.(ee-first@1.1.)
- ├── type-is@1.6.(media-typer@0.3., mime-types@2.1.)
- ├── send@0.13.(destroy@1.0., statuses@1.2., ms@0.7., mime@1.3., http-errors@1.3.)
- └── accepts@1.2.(negotiator@0.5., mime-types@2.1.)
- body-parser@1.13. node_modules/body-parser
- ├── content-type@1.0.
- ├── bytes@2.1.
- ├── depd@1.0.
- ├── qs@4.0.
- ├── on-finished@2.3.(ee-first@1.1.)
- ├── http-errors@1.3.(statuses@1.2., inherits@2.0.)
- ├── iconv-lite@0.4.
- ├── type-is@1.6.(media-typer@0.3., mime-types@2.1.)
- └── raw-body@2.1.(unpipe@1.0., bytes@2.2., iconv-lite@0.4.)
- jade@1.11. node_modules/jade
- ├── commander@2.6.
- ├── character-parser@1.2.
- ├── void-elements@2.0.
- ├── mkdirp@0.5.(minimist@0.0.)
- ├── constantinople@3.0.(acorn@2.7.)
- ├── clean-css@3.4.(commander@2.8., source-map@0.4.)
- ├── jstransformer@0.0.(is-promise@2.1., promise@6.1.)
- ├── transformers@2.1.(promise@2.0., css@1.0., uglify-js@2.2.)
- ├── with@4.0.(acorn@1.2., acorn-globals@1.0.)
- └── uglify-js@2.6.(async@0.2., uglify-to-browserify@1.0., source-map@0.5., yargs@3.10.)
- root@localhost DemoApp]#npm start
- >DemoApp@0.0. start /root/nodejs/DemoApp
- > node ./bin/www
- GET /200382.317 ms -
- GET /stylesheets/style.css 20017.834 ms -
- GET /favicon.ico 40456.666 ms -
- GET /favicon.ico 40439.911 ms -
- GET /30458.911 ms --
- GET /stylesheets/style.css 3041.839 ms --
- GET /30447.751 ms --
- GET /stylesheets/style.css 3040.280 ms --
- GET /30453.378 ms --
- GET /stylesheets/style.css 3040.258 ms --

- npm install express --save
安装4.x版本的express开发框架的更多相关文章
- CentOS安装NodeJS及Express开发框架
http://zhaohe162.blog.163.com/blog/static/38216797201402234212981/ express 命令行工具 npm install -g ex ...
- 安装了SQL2005再安装SQL 2008R2,提示此计算机上安装了 Microsoft Visual Studio 2008 的早期版本和检查是否安装了 SQL Server 2005 Express 工具的解决方案
工作电脑上安装了SQL 2005, 但是客户电脑上安装的是SQL 2008R2,有时候连接他们的库调试没法连接,很不方便.然后又安装了个SQL2008 R2,期间遇到这两个问题,网上搜索了一下收到了解 ...
- 一台电脑安装多个版本的jdk
我们平时在做Java开发的时候,有时需要使用多个版本的jdk, 那么一台电脑上需要安装多个JDK了. 那一台电脑上可不可以同时安装多个版本的jdk呢? 答案是可以的! 但使用的时候,只能使用一个,不能 ...
- 检测计算机已经安装的NetFramework版本(摘录)
/// /// 检测计算机已经安装的NetFramework版本 /// internal void GetVersionFromRegistry() { using (RegistryKey ndp ...
- window下在同一台机器上安装多个版本jdk,修改环境变量不生效问题处理办法
window下在同一台机器上安装多个版本jdk,修改环境变量不生效问题处理办法 本机已经安装了jdk1.7,而比较早期的项目需要依赖jdk1.6,于是同时在本机安装了jdk1.6和jdk1.7. 安装 ...
- 查看已安装的CentOS版本信息:
如何查看已安装的CentOS版本信息: 1)[root@localhost ~]# cat /proc/version Linux version 2.6.18-194.el5 (mockbuild@ ...
- Mac下同时安装多个版本的JDK
JDK8 GA之后,小伙伴们喜大普奔,纷纷跃跃欲试,想体验一下Java8的Lambda等新特性,可是目前Java企业级应用的主打版本还是JDK6, JDK7.因此,我需要在我的电脑上同时有JDK8,J ...
- Window 中安装python多版本环境
由于python 3 已是目前稳定,且是将来版本版本.新学者可以直接从python3入手学习.但是目前还有很多企业级应用使用的是python 2,可能还得要维护.所以,我们在本地windows中可以安 ...
- Linux系统启动流程及安装命令行版本
Debian安装 之前也安装过很多次linux不同版本的系统,但安装后都是直接带有桌面开发环境的版本,直接可以使用,正好最近项目不是很忙,想一直了解下Linux的整个启动流程,以及如何从命令行模式系统 ...
随机推荐
- js的原型继承小结
考虑:有一个想要复用的对象,并且想要创建的第二个对象需要从第一个对对象中获取其功能. 实现如下: //要继承的对象 var parent = { name:"Papa" }; // ...
- Javascript经典实例 - 正则表达式
1] 正则常用字符 正则表达式常用的特殊字符 字符 匹配 示例 ^ 匹配输入的开始 /^This/匹配 “This is ...” $ 匹配输入的结束 /end$/匹配“This is the end ...
- EF 拉姆达 动态拼接查询语句
EF 动态拼接查询语句 using System; using System.Collections.Generic; using System.IO; using System.Linq; usin ...
- mysql中的意向锁IS,IX
知识储备: 1.官方文档上说mysql是支持非锁定读的:这个功能是这样实现的,如果事务a 要对行的数据进行更新的话,那么事务a要得到行的x锁,并把这一行 之前的样子记录在undo log里面,这样一 ...
- c#实现生产者消费者模式
; } Environment.ExitCode = result; } }}
- iOS开发之网络篇-各种网络状态码
1xx消息 这一类型的状态码,代表请求已被接受,需要继续处理.这类响应是临时响应,只包含状态行和某些可选的响应头信息,并以空行结束.由于HTTP/1.0协议中没有定义任何1xx状态码,所以除非在某些试 ...
- USB系列之一:列出你的USB设备
USB现在已经成为PC机必不可少的接口之一,几乎所有的设备都可以接在USB设备上,USB键盘.鼠标.打印机.摄像头,还有常用的U盘等等,从本篇文章开始,将集中篇幅介绍一下在DOS中使用USB设备的方法 ...
- LeeCode-Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return t ...
- Web Service中的XFire 传输List 自定义对象.
我把这个创建的步骤和代码的贴出来,. 首先新建一个工程,取名就随便点啦..MyWebService,然后复制jar包到lib目录下, 创建包,建立接口..写一个javaBean的类, 以下是一个简单的 ...
- Flashback Version/Transaction Query
1.应用Flashback Version Query查询记修改版本 SQL> select dbms_flashback.get_system_change_number from dual; ...