这几天在小小的学习下nodejs,按照博文
http://cnodejs.org/topic/5191d30e63e9f8a542bc2758
中所记载的一步一步来运行个简单的例子。
当做到 session 的使用 这一小节的时候,
按照博文中的步骤下载session-mongoose 依赖库:
npm install session-mongoose
npm http GET https://registry.npmjs.org/session-mongoose npm http 200 https://registry.npmjs.org/session-mongoose npm http GET https://registry.npmjs.org/session-mongoose/-/session-mongoose-0.4. 1.tgz npm http 200 https://registry.npmjs.org/session-mongoose/-/session-mongoose-0.4. 1.tgz npm http GET https://registry.npmjs.org/mongoose npm http 200 https://registry.npmjs.org/mongoose npm http GET https://registry.npmjs.org/mongoose/-/mongoose-3.8.3.tgz npm http 200 https://registry.npmjs.org/mongoose/-/mongoose-3.8.3.tgz npm http GET https://registry.npmjs.org/hooks/0.2.1 npm http GET https://registry.npmjs.org/mongodb/1.3.19 npm http GET https://registry.npmjs.org/sliced/0.0.5 npm http GET https://registry.npmjs.org/ms/0.1.0 npm http GET https://registry.npmjs.org/mpromise/0.3.0 npm http GET https://registry.npmjs.org/muri/0.3.1 npm http GET https://registry.npmjs.org/mpath/0.1.1 npm http GET https://registry.npmjs.org/regexp-clone/0.0.1 npm http GET https://registry.npmjs.org/mquery/0.3.2 npm http 200 https://registry.npmjs.org/sliced/0.0.5 npm http 200 https://registry.npmjs.org/ms/0.1.0 npm http 200 https://registry.npmjs.org/mpromise/0.3.0 npm http 200 https://registry.npmjs.org/muri/0.3.1 npm http 200 https://registry.npmjs.org/regexp-clone/0.0.1 npm http 200 https://registry.npmjs.org/mpath/0.1.1 npm http GET https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz npm http GET https://registry.npmjs.org/ms/-/ms-0.1.0.tgz npm http GET https://registry.npmjs.org/muri/-/muri-0.3.1.tgz npm http GET https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz npm http GET https://registry.npmjs.org/mpromise/-/mpromise-0.3.0.tgz npm http GET https://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz npm http 200 https://registry.npmjs.org/hooks/0.2.1 npm http 200 https://registry.npmjs.org/mongodb/1.3.19 npm http 200 https://registry.npmjs.org/mquery/0.3.2 npm http GET https://registry.npmjs.org/mquery/-/mquery-0.3.2.tgz npm http GET https://registry.npmjs.org/hooks/-/hooks-0.2.1.tgz npm http GET https://registry.npmjs.org/mongodb/-/mongodb-1.3.19.tgz npm http 200 https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz npm http 200 https://registry.npmjs.org/ms/-/ms-0.1.0.tgz npm http 200 https://registry.npmjs.org/muri/-/muri-0.3.1.tgz npm http 200 https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz npm http 200 https://registry.npmjs.org/mpromise/-/mpromise-0.3.0.tgz npm http 200 https://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz npm http 200 https://registry.npmjs.org/hooks/-/hooks-0.2.1.tgz npm http 200 https://registry.npmjs.org/mquery/-/mquery-0.3.2.tgz npm http 200 https://registry.npmjs.org/mongodb/-/mongodb-1.3.19.tgz npm http GET https://registry.npmjs.org/debug/0.7.0 npm http GET https://registry.npmjs.org/bson/0.2.2 npm http GET https://registry.npmjs.org/kerberos/0.0.3 npm http 200 https://registry.npmjs.org/debug/0.7.0 npm http GET https://registry.npmjs.org/debug/-/debug-0.7.0.tgz npm http 200 https://registry.npmjs.org/bson/0.2.2 npm http 200 https://registry.npmjs.org/kerberos/0.0.3 npm http GET https://registry.npmjs.org/kerberos/-/kerberos-0.0.3.tgz npm http GET https://registry.npmjs.org/bson/-/bson-0.2.2.tgz npm http 200 https://registry.npmjs.org/debug/-/debug-0.7.0.tgz npm http 200 https://registry.npmjs.org/kerberos/-/kerberos-0.0.3.tgz npm http 200 https://registry.npmjs.org/bson/-/bson-0.2.2.tgz > kerberos@0.0.3 install c:\sap\java\nodejs\examples\microblog\node_modules\sess ion-mongoose\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos > (node-gyp rebuild 2> builderror.log) || (exit 0) c:\sap\java\nodejs\examples\microblog\node_modules\session-mongoose\node_modules \mongoose\node_modules\mongodb\node_modules\kerberos>node "C:\sap\java\nodejs\no de_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" re build Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua l Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [c:\sap\java\nodejs\examples\microblog\node_modules\se ssion-mongoose\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos \build\binding.sln] > bson@0.2.2 install c:\sap\java\nodejs\examples\microblog\node_modules\session- mongoose\node_modules\mongoose\node_modules\mongodb\node_modules\bson > (node-gyp rebuild 2> builderror.log) || (exit 0) c:\sap\java\nodejs\examples\microblog\node_modules\session-mongoose\node_modules \mongoose\node_modules\mongodb\node_modules\bson>node "C:\sap\java\nodejs\node_m odules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuil d Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua l Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [c:\sap\java\nodejs\examples\microblog\node_modules\se ssion-mongoose\node_modules\mongoose\node_modules\mongodb\node_modules\bson\bui ld\binding.sln] npm http GET https://registry.npmjs.org/connect npm http 200 https://registry.npmjs.org/connect npm http GET https://registry.npmjs.org/connect/-/connect-2.12.0.tgz npm http 200 https://registry.npmjs.org/connect/-/connect-2.12.0.tgz npm http GET https://registry.npmjs.org/batch/0.5.0 npm http GET https://registry.npmjs.org/qs/0.6.6 npm http GET https://registry.npmjs.org/debug npm http GET https://registry.npmjs.org/cookie-signature/1.0.1 npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1 npm http GET https://registry.npmjs.org/bytes/0.2.1 npm http GET https://registry.npmjs.org/cookie/0.1.0 npm http GET https://registry.npmjs.org/send/0.1.4 npm http GET https://registry.npmjs.org/multiparty/2.2.0 npm http GET https://registry.npmjs.org/negotiator/0.3.0 npm http GET https://registry.npmjs.org/uid2/0.0.3 npm http GET https://registry.npmjs.org/fresh/0.2.0 npm http GET https://registry.npmjs.org/raw-body/1.1.2 npm http GET https://registry.npmjs.org/pause/0.0.1 npm http GET https://registry.npmjs.org/methods/0.1.0 npm http 200 https://registry.npmjs.org/qs/0.6.6 npm http 200 https://registry.npmjs.org/batch/0.5.0 npm http GET https://registry.npmjs.org/qs/-/qs-0.6.6.tgz npm http GET https://registry.npmjs.org/batch/-/batch-0.5.0.tgz npm http 200 https://registry.npmjs.org/cookie-signature/1.0.1 npm http 200 https://registry.npmjs.org/buffer-crc32/0.2.1 npm http 200 https://registry.npmjs.org/cookie/0.1.0 npm http 200 https://registry.npmjs.org/bytes/0.2.1 npm http 200 https://registry.npmjs.org/multiparty/2.2.0 npm http 200 https://registry.npmjs.org/send/0.1.4 npm http 200 https://registry.npmjs.org/pause/0.0.1 npm http 200 https://registry.npmjs.org/uid2/0.0.3 npm http 200 https://registry.npmjs.org/methods/0.1.0 npm http 200 https://registry.npmjs.org/raw-body/1.1.2 npm http 200 https://registry.npmjs.org/fresh/0.2.0 npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0. 1.tgz npm http GET https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz npm http GET https://registry.npmjs.org/bytes/-/bytes-0.2.1.tgz npm http GET https://registry.npmjs.org/send/-/send-0.1.4.tgz npm http GET https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz npm http GET https://registry.npmjs.org/pause/-/pause-0.0.1.tgz npm http GET https://registry.npmjs.org/methods/-/methods-0.1.0.tgz npm http GET https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz npm http GET https://registry.npmjs.org/multiparty/-/multiparty-2.2.0.tgz npm http GET https://registry.npmjs.org/raw-body/-/raw-body-1.1.2.tgz npm http GET https://registry.npmjs.org/fresh/-/fresh-0.2.0.tgz npm http 200 https://registry.npmjs.org/debug npm http 200 https://registry.npmjs.org/negotiator/0.3.0 npm http GET https://registry.npmjs.org/negotiator/-/negotiator-0.3.0.tgz npm http 200 https://registry.npmjs.org/qs/-/qs-0.6.6.tgz npm http 200 https://registry.npmjs.org/batch/-/batch-0.5.0.tgz npm http 200 https://registry.npmjs.org/bytes/-/bytes-0.2.1.tgz npm http 200 https://registry.npmjs.org/send/-/send-0.1.4.tgz npm http 200 https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz npm http 200 https://registry.npmjs.org/methods/-/methods-0.1.0.tgz npm http 200 https://registry.npmjs.org/pause/-/pause-0.0.1.tgz npm http 200 https://registry.npmjs.org/multiparty/-/multiparty-2.2.0.tgz npm http 200 https://registry.npmjs.org/raw-body/-/raw-body-1.1.2.tgz npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0. 1.tgz npm http 200 https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz npm http 200 https://registry.npmjs.org/fresh/-/fresh-0.2.0.tgz npm http 200 https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz npm http 200 https://registry.npmjs.org/negotiator/-/negotiator-0.3.0.tgz npm http GET https://registry.npmjs.org/mime npm http GET https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/stream-counter npm http GET https://registry.npmjs.org/readable-stream npm http 200 https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz npm http 200 https://registry.npmjs.org/mime npm http 200 https://registry.npmjs.org/stream-counter npm http 200 https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz npm http 200 https://registry.npmjs.org/readable-stream npm http GET https://registry.npmjs.org/core-util-is npm http GET https://registry.npmjs.org/debuglog/0.0.2 npm http 200 https://registry.npmjs.org/core-util-is npm http 200 https://registry.npmjs.org/debuglog/0.0.2 npm http GET https://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz npm http 200 https://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz connect@2.12.0 node_modules\connect ├── uid2@0.0.3 ├── qs@0.6.6 ├── debug@0.7.4 ├── methods@0.1.0 ├── pause@0.0.1 ├── cookie-signature@1.0.1 ├── fresh@0.2.0 ├── raw-body@1.1.2 ├── buffer-crc32@0.2.1 ├── negotiator@0.3.0 ├── bytes@0.2.1 ├── batch@0.5.0 ├── cookie@0.1.0 ├── send@0.1.4 (range-parser@0.0.4, mime@1.2.11) └── multiparty@2.2.0 (stream-counter@0.2.0, readable-stream@1.1.9) session-mongoose@0.4.1 node_modules\session-mongoose └── mongoose@3.8.3 (regexp-clone@0.0.1, hooks@0.2.1, sliced@0.0.5, muri@0.3.1, m promise@0.3.0, mpath@0.1.1, ms@0.1.0, mquery@0.3.2, mongodb@1.3.19)
在下载过程中需要build,在build的时候提示:
Could not load the Visual C++ component "VCBuild.exe"
无视之、、、
再重新编译运行例子的js代码,提示如下错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (c:\sap\java\nodejs\examples\microblog\node_modules\sess
ion-mongoose\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\s
erver.js:540:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (c:\sap\java\nodejs\examples\microblog\node_modules\sess
ion-mongoose\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\c
onnection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (c:\sap\java\nodejs\examples\microblog\node_modules\se
ssion-mongoose\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection
\connection.js:478:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
搜了下发现原来是需要安装mongodb,于是转到mongodb下载页面.
由于我的开发环境是:
Win7 64-Bit English Version.
于是就按照mongodb文档 Install MongoDB on Windows 在本机进行安装。
安装完毕,启动mongodb:
c:\sap\java\db\mongdb>mongodb-2.4.8\bin\mongod.exe --dbpath c:\sap\java\db\mongdb\data
完了之后再次运行express 的例子,测试运行通过。
相关推荐
1. **中间件系统重构**:Express3.0移除了`app.controller`,并统一使用`app.use`和`app.get/post/put/delete`等方法来注册中间件。这使得中间件处理更加清晰,减少了代码中的混乱。 2. **依赖注入**:Express3.0...
开发语言:nodejs 框架:Express 数据库:mysql 5.6 开发软件:VS code 采用基于nodejs的环境和express框架开发一个前后端分离的宠物购物网站,一共包括2个身份包括管理员和用户。前台用户可以注册账号和登录,可以...
Vue.js、Node.js、Express和MyBatis是四个在Web开发中广泛应用的技术栈。这个项目案例结合了前端的Vue.js框架、后端的Node.js与Express框架,以及数据库操作的MyBatis持久层框架,构建了一个完整的Web应用程序。下面...
节点js NodeJS示例项目
用node开发应用程序,通常采用express框架进行功能扩展,当系统开发完成后,需要对nodejs+express工程打包封装。最常用的打包方式是使用pkg。本篇主要解决采用pkg打包后生成exe安装包,默认的图标是node的绿色六边形...
1. **路由**:Express中的路由是URL路径和处理函数之间的映射。例如,`/blog`路由可能对应一个展示所有博客文章的函数。 2. **中间件**:Express的中间件函数是接收请求并可选择传递给下一个中间件的函数。它们常...
**标题:“jinwei_nodejs_express”*...综上所述,“jinwei_nodejs_express”是一个针对Express框架进行优化的项目,它简化了多进程管理和session保持,同时通过配置文件简化了应用启动流程,为Node.js开发提供了便利。
毕业设计,基于Vue+NodeJS+Express+MongoDb开发的在线考试系统,内含NodeJS完整源代码,数据库脚本 基于Vue+Express+MongoDB在线考试系统设计毕业源码案例设计 开发工具: WebStorm 开发环境:Nodejs + vue + ...
nodejs也是一个最近越来越流行的技术,这也是自己第一次接触nodejs,在nodejs开发中,最常用的开发框架之一是expess,它是一个类似mvc模式的框架。结合html5、nodejs express实现了拖拽上传的功能。
基于NodeJS+Express+mongoDB+Bootstrap的全栈式工程化开发前后端分离博客系统实战
标题中的“nodejs+express+mongodb+bootstrap+jquery+ejs写的电影demo”表明这是一个使用Node.js、Express框架、MongoDB数据库、Bootstrap前端框架、jQuery库以及EJS模板引擎开发的电影相关的应用程序示例。...
毕业设计,基于Nodejs+Express+WebSocket开发的网络在线聊天室系统,内含NodeJS完整源代码,数据库脚本 基于Nodejs+Express+WebSocket网络在线聊天室系统设计 开发软件:Vscode,mysql 技术栈:nodejs,express,...
毕业设计,基于NodeJs+Express+Mysql开发的学生社团活动管理系统,内含NodeJS完整源代码,数据库脚本 基于NodeJs+Express+Mysql学生社团活动管理系统 开发技术:nodejs + express + ElementUI + layui 开发工具...
vue+nodejs+express+mybatis and vue+nodejs+express+mybatis资源分享
在开发过程中,Express 还支持路由定义,允许你为不同的 URL 路径设置不同的处理函数。同时,Express 支持模板引擎,如 EJS 或 Pug,可以方便地生成 HTML 响应。此外,Express 还提供了错误处理机制,使得开发过程...
基于NodeJS的Express框架开发的动态网站项目源码+项目说明(已实现首页导航栏+中部轮播图+以及电影列表的展现+底部导航链接+注册页面+视频播放页面+搜索页面+登录页面+用户管理页面+一键安装+电影抓取等功能).zip
毕业设计,基于Vue+NodeJS+Express+MongoDb开发的在线点餐系统,内含NodeJS完整源代码,数据库脚本 基于Vue+express+mongoDB在线点餐系统设计毕业源码案例设计 开发工具: WebStorm 开发环境:Nodejs + vue + ...
在IT行业中,Node.js是一个基于Chrome V8引擎的JavaScript运行环境,它允许开发者在服务器端使用JavaScript进行开发。Express则是Node.js的一个轻量级Web应用框架,它简化了构建Web服务的过程,使得开发者能够快速...
本文主要介绍NodeJS+Express+Mysql 实现POST和GET请求的增删改查,后续会在博客发布详细说明,可以关注一下
要检查NodeJS的版本,请在cmd中运行Node -v 。 2.创建package.json 要创建package.json,请运行npm init并填充信息或npm init --yes ,以获取更快的方法 3.安装Express 是NodeJS的Web框架。 要安装Express,请...