首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >heroku支持dnode吗?

heroku支持dnode吗?
EN

Stack Overflow用户
提问于 2013-05-29 02:54:29
回答 1查看 174关注 0票数 1

当我尝试在heroku上应用这个简单的节点应用程序时,我得到了错误:

代码语言:javascript
复制
no port or path provided

下面是应用程序:

server.js

代码语言:javascript
复制
var express = require("express");
var app = express();
app.use(express.logger());

app.get('/', function(request, response) {
  response.send('Hello World!');
});

var port = process.env.PORT || 5000;
app.listen(port, function() {
  console.log("Listening on " + port);
});

var dnode = require('dnode');
var server = dnode({
    zing : function (n, cb) { cb(n * 100) }
});
server.listen(app);

这是浏览器的index.html

代码语言:javascript
复制
<html>
<head>
    <script src="/dnode.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function () {

            DNode.connect(function (remote) {
                remote.zing(66, function (n) {
                    document.getElementById('result').innerHTML = n;
                });
            });

        };
    </script>
</head>
<body>

n = <span id="result">?</span>

</body>
</html>

然后,heroku日志:

代码语言:javascript
复制
2013-05-28T18:38:55.246545+00:00 app[web.1]:         throw new Error('no port or path provided');
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at D.dnode.listen (/app/node_modules/dnode/index.js:119:15)
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:20:8)
2013-05-28T18:38:55.246124+00:00 app[web.1]: /app/node_modules/dnode/index.js:119
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at node.js:901:3
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2013-05-28T18:38:55.246854+00:00 app[web.1]:               ^
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at startup (node.js:119:16)
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-05-28T18:38:55.249503+00:00 app[web.1]: Error: no port or path provided
2013-05-28T18:38:55.249503+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2013-05-28T
18:38:55.249503+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-05-28T18:38:56.512438+00:00 heroku[web.1]: Process exited with status 8
2013-05-28T18:38:56.530982+00:00 heroku[web.1]: State changed from starting to crashed
2013-05-28T18:39:04.462914+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-05-28T18:39:04.462914+00:00 heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds

我是不是漏掉了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-29 04:20:58

您正在使用旧版本的api (<1)。新版本只是一个流。查看当前的自述文件,了解如何使用pipe everything together with the new api

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16799349

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档