【问题标题】:Heroku Node.JS errorsHeroku Node.JS 错误
【发布时间】:2013-04-21 19:13:35
【问题描述】:

在我部署我的 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

【问题讨论】:

    标签: node.js heroku


    【解决方案1】:

    尝试检查您的 /app/routes.js 文件,会有一个没有两个参数的路由。尝试在第 23 行注释掉。

    或者没有正确定义,但是这个问题应该与 Heroku 无关,当你在本地启动 node app.js 时应该会抛出错误耸耸肩

    希望你设法对其进行排序!

    【讨论】:

    • 或者,如果你像我一样傻,你把一个函数的名字放进去,却一直没有时间写这个函数! (当你在 6 个月后回到一个业余项目时会感到困惑!)
    【解决方案2】:

    似乎这是您应用的问题,而不是与 Heroku 相关的问题。

    你应该尝试在本地运行项目,找出问题所在。

    检查您的 `app/routes.js' 文件。

    【讨论】:

      猜你喜欢
      • 2019-01-03
      • 2016-01-05
      • 2017-01-21
      • 1970-01-01
      • 1970-01-01
      • 2021-05-02
      • 2012-03-10
      • 2020-04-30
      • 1970-01-01
      相关资源
      最近更新 更多