Node.js mongoose模块在Heroku上失败

时间:2014-01-11 15:40:16

标签: node.js heroku mongoose

几天前,我们的网站 http://emaildelivery.herokuapp.com 会显示应用错误:

  

“应用程序中发生错误,您的页面无法执行   提供服务。请稍后再试。

     

如果您是应用程序所有者,请查看日志以获取详细信息。“

我们的Heroku日志显示:

Jan 11 03:37:47 emaildelivery app/web.1: module.js:340 
Jan 11 03:37:47 emaildelivery app/web.1: throw err; 
Jan 11 03:37:47 emaildelivery app/web.1: ^ 
Jan 11 03:37:47 emaildelivery app/web.1: Error: Cannot find module './collection/shared' 
Jan 11 03:37:47 emaildelivery app/web.1: at Function.Module._resolveFilename (module.js:338:15) 
Jan 11 03:37:47 emaildelivery app/web.1: at Function.Module._load (module.js:280:25) 
Jan 11 03:37:47 emaildelivery app/web.1: at Module.require (module.js:364:17) 
Jan 11 03:37:47 emaildelivery app/web.1: at require (module.js:380:17) 
Jan 11 03:37:47 emaildelivery app/web.1: at Object.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:14:14) 
Jan 11 03:37:47 emaildelivery app/web.1: at Module._compile (module.js:456:26) 
Jan 11 03:37:47 emaildelivery app/web.1: at Object.Module._extensions..js (module.js:474:10) 
Jan 11 03:37:47 emaildelivery app/web.1: at Module.load (module.js:356:32) 
Jan 11 03:37:47 emaildelivery app/web.1: at Function.Module._load (module.js:312:12) 
Jan 11 03:37:47 emaildelivery app/web.1: at Module.require (module.js:364:17) 
Jan 11 03:37:48 emaildelivery heroku/web.1: Process exited with status 8 
Jan 11 03:37:48 emaildelivery heroku/web.1: State changed from starting to crashed 
Jan 11 04:13:36 emaildelivery heroku/router: at=error code=H10 desc="App crashed" method=GET path=/robots.txt host=emaildelivery.herokuapp.com fwd="66.249.73.12" dyno= connect= service= status=503 bytes= 

奇怪的是,该网站在多台开发机器上本地运行良好。它只是在Heroku上它会死掉。我们已经尝试升级/降级node.js版本和mongoose模块版本,但似乎无法解决这个问题。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您是否尝试删除node_modules文件夹并执行npm install并查看结果?这就是Heroku正在做的事情。也许您已将node_modules添加到您的存储库中,并且正在上载并使其不一致。