安装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的整个启动流程,以及如何从命令行模式系统 ...
随机推荐
- 我的开源框架之Accordion控件
需求: (1)实现手风琴面板控件,支持静态HTML与JSON方式创建控件 (2)支持远程加载数据 (3)支持面板激活.远程加载事件注册 (4)支持动态添加.删除项目 实现图例 客户代码 <div ...
- BC 65 game
主持人一直某个数字在1到n范围,假设甲乙已经知道,甲先猜乙后,都采用最优策略,主持人说偏大还是偏小,不断缩小范围,问最后乙能会获胜的X的取值的个数. 如果n为奇数,那么仅当x=n/2乙必然获胜,若为奇 ...
- Parallel并行编程
Parallel并行编程 Parallel并行编程可以让我们使用极致的使用CPU.并行编程与多线程编程不同,多线程编程无论怎样开启线程,也是在同一个CPU上切换时间片.而并行编程则是多CPU核心同时工 ...
- NOI十连测 第六测 T3
思路:考试的时候我非常地**,写了圆并,然后还TM写了半平面交和三角剖分,虽然只有30分..但是看在我写了500行的份上还是挂着吧.. #include<cstdio> #include& ...
- NOI十连测 第三测 T1
这么二逼的题考试的时候我想了好久,我真是太弱了... 首先,由于ans都乘上了i*(i-1)/2,实际上要求的就是每个数的所有可能出现次数*这个数的权值. 我们发现,每个数的本质是一样的,我们记一个s ...
- javascript之对象
一.创建对象 1.对象直接量. var point = { x:0,y:0 }; //point就是一个对象,跟C#不同,它不需要一定有类才能创建对象. 2.通过new创建对象 var d = new ...
- Erlang千万级用户游戏框架(Openpoker)源码文件分析清单
openpoker源码 erlang写的网游服务器源码,OpenPoker是一个大型多人扑克网游,内建支持了容错能力,负载平衡和无限制的规模大小.本文是openpoker源码文件功能的一个清单式说明: ...
- 2014第2周四部署环境&买火车票
2014第2周四部署环境&买火车票 今天遇到mysql一个问题:要把两个包含不同数据库的绿色mysql安装包中的数据库文件合并到一个数据库中,之前在sqlserver下操作很简单,只需要分离. ...
- SSIS 系列 - 在 SSIS 中使用 Multicast Task 将数据源数据同时写入多个目标表,备份数据表,以及写入Audit 信息
转自http://www.cnblogs.com/biwork/p/3328838.html 在 SSIS Data Flow 中有一个 Multicast 组件,它的作用和 Merge, Merge ...
- 总结 XSS 与 CSRF 两种跨站攻击
前言 在那个年代,大家一般用拼接字符串的方式来构造动态 SQL 语句创建应用,于是 SQL 注入成了很流行的攻击方式.在这个年代, 参数化查询 [1] 已经成了普遍用法,我们已经离 SQL 注入很远了 ...