安装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的整个启动流程,以及如何从命令行模式系统 ...
随机推荐
- mysql install
./scripts/mysql_install_db --user=mahao01 --basedir=/home/mahao01/local/mysql --datadir=/home/mahao0 ...
- gulp压缩js
1.安装nodejs -> 全局安装gulp -> 项目安装gulp以及gulp插件 -> 配置gulpfile.js -> 运行任务 2.查看nodejs的版本号 3.npm ...
- Bulk-Only传输协议 UFI命令块规范
USB设备分为5大类,即显示器.通信设备.音频设备.人机输入和海量存储.通常所用的U盘.移动硬盘均属于海量存储类.海量存储类的规范中包括4个独立的子规范,即CBI传输.Bulk-Only传输.ATA命 ...
- 【剑指offer】面试题22:栈的压入、弹出序列
题目: 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列 ...
- mysql的主从复制原理
一个简单完整的 Mysql 主从复制,读写分离的示意图. 1. 首先搭建 Mysql 主从架构,实现 将 mater 数据自动复制到 slave MySQL 复制的工作方式很简单,一台服务器作为主机, ...
- Can you find it?(二分 二分+STL set map)
Can you find it? Time Limit : 10000/3000ms (Java/Other) Memory Limit : 32768/10000K (Java/Other) T ...
- android面试题之五
二十六.什么情况会导致Force Close ?如何避免?能否捕获导致其的异常? 抛出运行时异常时就会导致Force Close,比如空指针.数组越界.类型转换异常等等. 捕获:可以通过logcat查 ...
- Android系统Surface机制的SurfaceFlinger服务的线程模型分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8062945 在前面两篇文章中,我们分析了Sur ...
- java学习笔记day07
1.throwable下面的子类分为两大类:Error 和 Exception 2.如果方法上有throws Exception,则必须对异常进行处理: try{ 需要检测异常代码 } ...
- 关于mysql binlog日志的格式说明
Binary Log 记录方式 Row Level Binary Log会记录成每一行数据被修改的形式,然后在Slave端再对相同的数据进行修改. 如果修改了表的结构,那么binlog日志记录的是重新 ...