在部署我的node.js应用程序后,Heroku给了我这个错误。你知道错误信息是什么意思吗?谢谢!
2013-01-14T22:50:34+00:00 heroku[web.1]: State changed from crashed to starting
2013-01-14T22:50:36+00:00 heroku[web.1]: Starting process with command `node app.js`
2013-01-14T22:50:37+00:00 app[web.1]:
2013-01-14T22:50:37+00:00 app[web.1]: /app/node_modules/express/lib/router/index.js:252
2013-01-14T22:50:37+00:00 app[web.1]: throw new Error(msg);
2013-01-14T22:50:37+00:00 app[web.1]: ^
2013-01-14T22:50:37+00:00 app[web.1]: Error: .get() requires callback functions but got a [object Undefined]
2013-01-14T22:50:37+00:00 app[web.1]: at Router.route.Route.sensitive (/app/node_modules/express/lib/router/index.js:252:11)
2013-01-14T22:50:37+00:00 app[web.1]: at Array.forEach (native)
2013-01-14T22:50:37+00:00 app[web.1]: at Router.route (/app/node_modules/express/lib/router/index.js:248:13)
2013-01-14T22:50:37+00:00 app[web.1]: at Router.methods.forEach.Router.(anonymous function) [as get] (/app/node_modules/express/lib/router/index.js:270:16)
2013-01-14T22:50:37+00:00 app[web.1]: at Function.methods.forEach.app.(anonymous function) [as get] (/app/node_modules/express/lib/application.js:411:26)
2013-01-14T22:50:37+00:00 app[web.1]: at Routes.self.init (/app/routes.js:23:9)
2013-01-14T22:50:37+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:42:8)
2013-01-14T22:50:37+00:00 app[web.1]: at Module._compile (module.js:449:26)
2013-01-14T22:50:37+00:00 app[web.1]: at Object.Module._extensions..js (module.js:467:10)
2013-01-14T22:50:37+00:00 app[web.1]: at Module.load (module.js:356:32)
2013-01-14T22:50:38+00:00 heroku[web.1]: State changed from starting to crashed
2013-01-14T22:50:38+00:00 heroku[web.1]: Process exited with status 1
答案 0 :(得分:1)
尝试检查/app/routes.js文件,会有一条没有两个参数的路由。尝试在第23行附近发表评论。
或者没有正确定义,但是这个问题不应该与Heroku相关,并且当你在本地启动节点app.js时它应该抛出错误耸肩
希望你设法对它进行排序!
答案 1 :(得分:0)
似乎这是你的应用程序的问题,而不是与Heroku相关的问题。
您应该尝试在本地运行项目,并找出问题。
检查你的`app / routes.js'文件。