通过 git 部署时 Heroku 错误“code=H10”“status=503”

时间:2021-01-08 06:38:38

标签: node.js heroku heroku-cli

我正在使用 git 将我的节点应用程序部署到 Heroku,但 Heroku 记录 --tails 记录“error=H10”和“status=503”。我尝试了 proc 文件和 package.json 几次,但对我来说没有任何效果。这是我的节点 app.js、package.json、procfile 和 git ignore。

app.js

const app = express();
app.use(express.static("public"));
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use('/profile', express.static('uploads'));

app.listen(process.env.PORT || 3000, function () {
console.log("Express server listening on port %d in %s mode", this.address().port, 
app.settings.env);
});

这是我的完整 app.js 文件:https://codesandbox.io/s/cool-dew-quvm7?file=/src/app.js

Gitignore

/node_modules
npm-debug.log
/*.env
/build

Procfile

web: node app.js

Package.json

{
  "name": "kim_webv1",
  "version": "1.0.0",
  "description": "initial build",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node app.js"
  },
  "author": "mynamewashere",
  "license": "ISC",
  "engines":{
    "node": "12.19.0",
    "npm": "6.14.8"
  },
  "dependencies": {
    "body-parser": "^1.19.0",
    "dotenv": "^8.2.0",
    "ejs": "^3.1.5",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "fs": "0.0.1-security",
    "md5": "^2.3.0",
    "mongodb": "^3.6.3",
    "mongoose": "^5.11.0",
    "mongoose-findorcreate": "^3.0.0",
    "multer": "^1.4.2",
    "passport": "^0.4.1",
    "passport-google-oauth20": "^2.0.0",
    "passport-local": "^1.0.0",
    "passport-local-mongoose": "^6.0.1",
    "path": "^0.12.7"
  }
}

0 个答案:

没有答案