【发布时间】:2013-07-09 14:01:02
【问题描述】:
当我在本地运行我的 nodejs 代码时,它运行良好。我得到了想要的输出。
我的代码:
var fs = require("fs");
fs.readFile("index.html", function (err, data) {
if (err) throw err;
console.log(data.toString());
});
本地运行时
- index.html 包含“来自 index.html 的 Hello World”,并且位于同一目录中。
问题:
当我尝试在 heroku 上部署 web.js(包含与上面相同的代码)时,它似乎不起作用。
我希望在 heroku 上部署“Hello World from index.html”时显示它。
- web.js 在我的github repository
执行以下命令
git push heroku master之后
这里是 heroku URL 显示的内容
背景:我使用的是 AWS Ubuntu 12.04,我的 github 存储库是 this,其中包含所需的 web.js 文件。我正在使用 Cygwin。
可能有什么问题。我是 nodejs 的新手,所以我想我在这里遗漏了一些非常基本的东西。如果您是专家,请善意回答这个愚蠢的问题。从字面上看,我整晚都想弄清楚。 我想要的只是从 index.html 文件中读取并在部署到 Heroku 时在“http://nameless-headland-9348.herokuapp.com/”上显示它包含的文本。
【问题讨论】: