【问题标题】:Heroku deployment Error with node.jsnode.js 的 Heroku 部署错误
【发布时间】:2016-01-05 19:09:06
【问题描述】:

应用程序在 node.js 中编程,并使用 socket.io 进行实时请求。

应用程序运行良好,但今天我收到了这个无限错误:

2015-10-08T08:31:37.477080+00:00 app[web.1]: Prevented node from exit...
2015-10-08T08:31:37.477495+00:00 app[web.1]: TypeError: Cannot read property 'length' of undefined
2015-10-08T08:31:37.477496+00:00 app[web.1]:     at onwriteDrain (_stream_writable.js:354:12)
2015-10-08T08:31:37.477497+00:00 app[web.1]:     at afterWrite (_stream_writable.js:344:5)
2015-10-08T08:31:37.477498+00:00 app[web.1]:     at wrapped (/app/node_modules/newrelic/lib/transaction/tracer/index.js:157:28)
2015-10-08T08:31:37.477498+00:00 app[web.1]:     at doNTCallback0 (node.js:408:9)
2015-10-08T08:31:37.477499+00:00 app[web.1]:     at Immediate._tickCallback [as _onImmediate] (node.js:337:13)
2015-10-08T08:31:37.477500+00:00 app[web.1]:     at processImmediate [as _immediateCallback] (timers.js:374:17)
2015-10-08T08:31:37.477873+00:00 app[web.1]: TypeError: Cannot read property 'length' of undefined
2015-10-08T08:31:37.477503+00:00 app[web.1]: Prevented node from exit...
2015-10-08T08:31:37.477875+00:00 app[web.1]:     at onwriteDrain (_stream_writable.js:354:12)
2015-10-08T08:31:37.477875+00:00 app[web.1]:     at afterWrite (_stream_writable.js:344:5)
2015-10-08T08:31:37.477876+00:00 app[web.1]:     at wrapped (/app/node_modules/newrelic/lib/transaction/tracer/index.js:157:28)
2015-10-08T08:31:37.477877+00:00 app[web.1]:     at Immediate._tickCallback [as _onImmediate] (node.js:337:13)
2015-10-08T08:31:37.477877+00:00 app[web.1]:     at doNTCallback0 (node.js:408:9)
2015-10-08T08:31:37.477878+00:00 app[web.1]:     at processImmediate [as _immediateCallback] (timers.js:374:17)
2015-10-08T08:31:37.477900+00:00 app[web.1]: Prevented node from exit...

谁能帮忙!

我会很感激的,谢谢。

【问题讨论】:

  • 你试过查看“length”属性吗?您的代码中是否有 stream_writable.js 文件?

标签: javascript node.js heroku socket.io


【解决方案1】:

问题是来自 npm 的“请求”包,它与最新版本的 node.js 不兼容。

所以我在 package.js 中明确添加版本

"engines": {
  "node": "0.10.x"
},

现在一切正常。 谢谢

【讨论】:

    猜你喜欢
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 2018-01-14
    • 2021-02-12
    • 2021-05-10
    • 1970-01-01
    • 2011-03-25
    相关资源
    最近更新 更多