如何在Ubuntu上部署运行nodeclub
发布于 6个月前 作者 HypnosNova 487 次浏览 来自 问答

从github下载了nodeclub 已经正确安装了node.js和monogodb

现在我cd到nodeclub的目录,使用root输入:npm install 所有包依赖都安装好后,在nodeclub根目录新建了data文件夹,输入:mongod --dbpath … 然后输入:mongo 出现数据库正确启动的提示。

但是问题出现了,输入:node app.js 报错如下: Error: Cannot find module ‘mongodb’ at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/node_modules/mongoose/lib/utils.js:5:16) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/node_modules/mongoose/lib/schema.js:7:13) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/node_modules/mongoose/lib/index.js:7:14) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/node_modules/mongoose/index.js:7:18) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/models/index.js:1:78) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nova/Downloads/nodeclub-master/app.js:20:1) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:929:3

要怎么解决

5 回复

为什么会有mongodb这个包依赖?json里不是mongoose么

mongoose只是增强的功能(ORM,操作的还是mongodb

@coolicer 但是package.json没有mongodb的包啊,其他做的一些项目也没有这个包,现在这个问题要怎么解决?

运行 sudo npm install mongodb

path.exists is now called fs.exists. God bless love…

events.js:72 throw er; // Unhandled ‘error’ event ^ Error: listen EACCES at errnoException (net.js:905:11) at HTTPServer.Server._listen2 (net.js:1024:19) at listen (net.js:1065:10) at HTTPServer.Server.listen (net.js:1139:5) at Object.<anonymous> (/home/nova/nodeclub/app.js:65:5) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) nova@ubuntu:~/nodeclub$

回到顶部