Sequelize给TypeError

所以我随便开发了一个简单的node.js应用程序,它在我的电脑上工作得很好。 我安装了heroku工具栏 ,当我开始工头时,应用程序运行良好。
在heroku中部署应用程序似乎给了我一些使用sequelize与postgres连接时的错误(我甚至不能100%确定这是错误的原因,但几乎)。 该应用程序崩溃,我拥有的是heroku日志:

2014-01-05T11:07:39.850661+00:00 app[web.1]: Servidor escuchando al puerto: 25144 2014-01-05T11:07:39.911641+00:00 app[web.1]: 2014-01-05T11:07:39.912039+00:00 app[web.1]: timers.js:103 2014-01-05T11:07:39.912288+00:00 app[web.1]: if (!process.listeners('uncaughtException').length) throw e; 2014-01-05T11:07:39.913123+00:00 app[web.1]: ^ 2014-01-05T11:07:39.915970+00:00 app[web.1]: at TransactionManager.getConnectorManager (/app/node_modules/sequelize/lib/transaction-manager.js:25:36) 2014-01-05T11:07:39.915970+00:00 app[web.1]: at TransactionManager.query (/app/node_modules/sequelize/lib/transaction-manager.js:39:15) 2014-01-05T11:07:39.915970+00:00 app[web.1]: at module.exports.Sequelize.query (/app/node_modules/sequelize/lib/sequelize.js:310:36) 2014-01-05T11:07:39.915970+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/sequelize/lib/query-interface.js:901:40) 2014-01-05T11:07:39.915970+00:00 app[web.1]: TypeError: Cannot call method 'setTypeParser' of undefined 2014-01-05T11:07:39.915970+00:00 app[web.1]: at new module.exports.ConnectorManager (/app/node_modules/sequelize/lib/dialects/postgres/connector-manager.js:19:19) 2014-01-05T11:07:39.915970+00:00 app[web.1]: at module.exports.CustomEventEmitter.run (/app/node_modules/sequelize/lib/emitters/custom-event-emitter.js:24:18) 2014-01-05T11:07:39.915970+00:00 app[web.1]: at Timer.list.ontimeout (timers.js:101:19) 2014-01-05T11:07:41.217303+00:00 heroku[web.1]: Process exited with status 1 2014-01-05T11:07:41.234281+00:00 heroku[web.1]: State changed from starting to crashed 

第一行(“Servidor escuchando al puerto:XXXX”)实际上是app.js(主要的.js文件)的一部分,它是最后几行:

 http.createServer(app).listen(app.get('port'), function(){ console.log('Servidor escuchando al puerto: ' + app.get('port')); }); 

正如我之前所说,它本地运行良好(执行领class开始正确显示在本地主机上),但我没有对heroku运气。 感谢您的任何见解和帮助=)

编辑:我设法跟踪了一些错误,似乎有一个电话:

 pg.types.setTypeParser(20, String) 

sequelize模块中的某处,抛出错误,因为pg.types是未定义我通过简单的做检查:

 console.log(require('pg')); 

而且它确实似乎没有领域“types”是这样的意思是? 我错过了什么吗?

pg.types来自于pg的依赖:

看这里的包json:

https://github.com/brianc/node-postgres/blob/master/package.json

这是这里的包:

https://www.npmjs.org/package/pg-types

如果你没有,并且你通过npm安装了pg,请尝试删除pg并重新运行npm install,看看是否有错误。 它应该下载pg-types工具。

你可以在这里看到pg.types具体定义:

https://github.com/brianc/node-postgres/blob/master/lib/index.js