所以简而言之,我正在尝试: 通过 Codeship 和从 Codeship 到 Heroku部署 - https://expressjs.com/en/starter/hello-world.html 。
我一直在尝试遵循来自https://expressjs.com/en/starter/hello-world.html的非常基本的Hello-World express 教程,但随后 codeship check_url阶段无法在 Heroku 上正确加载,出现以下错误:
Connecting to intfdsf-dsfdfsdf-323423.herokuapp.com (intfdsf-dsfdfsdf-323423.herokuapp.com)|54.243.89.187|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2016-07-22 02:18:12 ERROR 503: Service Unavailable.
在设置命令下,我尝试了以下操作:
nvm install 0.10
nvm use 0.10
npm install
和
nvm install 6.3.0
nvm use 6.3.0
npm install
两者都以同样的方式失败。
并添加类似npm start
挂起该行的过程....
web: node server.js
为了以防万一和最佳实践,我添加了一个 Procfile并将 app.js 重命名为 server.js。最后,我确实engines
在我的定义中package.json
这样定义:
{
"name": "node-ship",
"version": "1.0.0",
"description": "",
"main": "server.js",
"engines": {
"node": "5.6.x",
"npm": "3.10.x"
},
"scripts": {
"start" : "node server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/slfkjsdlfjklsdkfj/node-ship.git"
},
"author": "slfkjsdlfjklsdkfj",
"license": "ISC",
"bugs": {
"url": "https://github.com/slfkjsdlfjklsdkfj/node-ship/issues"
},
"homepage": "https://github.com/slfkjsdlfjklsdkfj/node-ship#readme",
"dependencies": {
"express": "^4.14.0"
}
}
我错过了什么?这样我就可以让 Heroku 正确加载 expressjs,就像我运行时在本地加载一样node app.js
谢谢您的帮助。
这里也是 server.js 文件:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(5000, function () {
console.log('Example app listening on port 5000!');
});