安装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的整个启动流程,以及如何从命令行模式系统 ...
随机推荐
- html 学习笔记--基础篇
最近被部门经理要求看一下html,重新看发现好多以前看过的只是都忘记了或者以前走马观花看过没有记得住的东西,正好趁此机会在博客上记录一下,顺便的如果以后需要查找,这里有记录的话可能会比上网查快一点(也 ...
- CentOS 6.4 LNMP 环境编译安装
1.关闭 SELinux 编辑 /etc/selinux/config SELINUX="disabled" 2.安装编译器 yum install gcc gcc-c++ -y ...
- 解决Webservice内存溢出-用XmlWriter
XmlWriter 表示一个编写器,该编写器提供一种快速.非缓存和只进的方式来生成包含 XML 数据的流或文件.这个就可以不占用内存,将数据放入磁盘中.也就不会出现内存溢出 public class ...
- 段和RSEG用法
RSEG是段选择指令,要想明白它的意思就要了解段的意思. 段是程序代码或数据对象的存储单位.程序代码放到代码段,数据对象放到数据段.段分两种,一是绝对段,一是再定位段.绝对段在汇编语言中指定,在用L5 ...
- 八大排序c++可运行精简版,一目了然
#include <iostream> using namespace std; // 插入排序开始===================== void insert_sort(int a ...
- C#中List<T>用法
所属命名空间:System.Collections.Generic public classList<T> :IList<T>,ICollection<T>,IEn ...
- bzoj1637 [Usaco2007 Mar]Balanced Lineup
Description Farmer John 决定给他的奶牛们照一张合影,他让 N (1 ≤ N ≤ 50,000) 头奶牛站成一条直线,每头牛都有它的坐标(范围: 0..1,000,000,000 ...
- Grid++Report 报表开发工具
Grid++Report 报表开发工具 版本 更新日期 大小 下载 说明 Grid++Repoert6.0.0.6 2015/08/08 16.0M [下载] 锐浪报表工具最新版本,新增功能说 ...
- 微型 Python Web 框架 Bottle - Heroin blog
微型 Python Web 框架 Bottle - Heroin blog 微型 Python Web 框架 Bottle
- android中通过自定义xml实现你需要的shape效果 xml属性配置
在Android开发过程中,经常需要改变控件的默认样式, 那么通常会使用多个图片来解决.不过这种方式可能需要多个图片,比如一个按钮,需要点击时的式样图片,默认的式样图片,然后在写一个selector的 ...