我正在尝试在heroku上设置Weinre,但我遇到了一些问题。
我设法构建了这个应用程序,只需使用一个带有weinre npm依赖项的package.json和一个如下所示的Procfile
web: node_modules/weinre/weinre --httpPort $PORT起初,一切似乎都正常,客户端显示UI,JS文件加载正常,但调试不起作用,并且没有客户端出现在服务器端。
在查看日志时,我意识到对于每个包含/ws/target/*或/ws/client/*的请求,我都会收到404个错误
2012-05-31T22:37:53+00:00 heroku[router]: GET xxxx.herokuapp.com/target/target-script.js dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=190900
2012-05-31T22:37:36+00:00 heroku[router]: GET xxxx.herokuapp.com/ws/target/t-3 dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=9
2012-05-31T22:36:39+00:00 heroku[router]: POST xxxx.herokuapp.com/ws/client/c-1 dyno=web.1 queue=0 wait=0ms service=40ms status=404 bytes=9此设置在本地运行时没有任何问题。
我也尝试了--boundHost 0.0.0.0的Procilfe,得到了同样的错误。当我使用我的heroku应用域名/子域作为主机时,我得到了weinre: error running server: Error: listen EADDRNOTAVAIL错误
如果需要,您可以在github repo上签出源代码
https://github.com/felipesabino/weinre-heroku
编辑:可能与Heroku上不支持WebSockets有关:https://devcenter.heroku.com/articles/http-routing#websockets
最奇怪的是,同样的问题也发生在PhoneGap的weinre调试页面上,http://debug.phonegap.com/
有人知道怎么解决这个问题吗?
发布于 2012-06-06 13:56:46
我现在在Heroku上运行weinre,但我记得当我试图让它工作时,那是一场真正的噩梦。
这是使用weinre的2.0.0-pre-H0WVARLU-incubating,所以它可能有一点不同,但我必须做的是:
cli.coffee文件,并将boundHost设置为-all-作为默认的代码。我推荐使用if remoteAddress签入channelManager.coffee,因为您来自的地址是通过代理重新映射的,并且在详细调试时从来不是,而实际上您并不需要这个来运行它,这使得跟踪发生错误的位置(以及为什么请求没有路由)变得容易得多<代码>H212<代码>F213
我的Procfile最终变得非常简单,因为我试图尽可能“原生”地使用(请注意,代码库只包含weinre,它不是一个你正在做的模块):
web: node weinre我将所有端口更改都留给了process.env.PORT来处理,而不是从Procfile传入
基本上,我发现weinre实际上并不是为在代理后面工作而设计的!
发布于 2012-09-17 22:07:46
查看此拉取请求https://github.com/apache/incubator-cordova-weinre/pull/10
注意,不需要其他修改,Procfile可以设置选项(就像它应该做的那样),Weinre被正确地用作节点模块。
package.json (包含修复程序)
"dependencies" : {
"weinre": "https://github.com/downloads/AppGyver/incubator-cordova-weinre/apache-cordova-weinre-2.0.0-pre-H77LBWIW-incubating-bin.tar.gz"
},Procfile
web: node_modules/weinre/weinre --httpPort $PORT --boundHost -all- --debug true --verbose true发布于 2012-11-15 23:30:10
匹配
这两个提示对appfog也有很大帮助
此外,您还需要
将weinre重命名为app.js
process.env.PORT执行 direct
https://stackoverflow.com/questions/10842446
复制相似问题