简体   繁体   English

修复 Heroku 以状态 1 退出,错误代码 H10

[英]Fixing Heroku exited with status 1, error code H10

I have attempted various resolutions;我尝试了各种解决方案; using GitHub as the deployment method, installing the NPM package serve, force cleaning cache, re-installing node_modules & package-lock.json and even switching the project from NPM to Yarn. using GitHub as the deployment method, installing the NPM package serve, force cleaning cache, re-installing node_modules & package-lock.json and even switching the project from NPM to Yarn. I still get the following error.我仍然收到以下错误。

Error log:错误日志:

2022-01-17T16:20:29.660758+00:00 heroku[web.1]: Process exited with status 1 2022-01-17T16:20:29.752386+00:00 heroku[web.1]: State changed from starting to crashed 2022-01-17T16:20:30.611091+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ip-tracker-app.herokuapp.com request_id=a46f3082-43fd-45e9-a049-d1076cad194f fwd="2.125.111.225" dyno= connect= service= status=503 bytes= protocol=https 2022-01-17T16:20:31.020509+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ip-tracker-app.herokuapp.com request_id=c01ac432-ae1c-4994-9fa0-b211a8f00391 fwd="2.125.111.225" dyno= connect= service= status=503 bytes= protocol=https 2022-01-17T16:20:29.660758+00:00 heroku[web.1]:进程以状态 1 退出 2022-01-17T16:20:29.752386+00:00 heroku[web.1]:State 从开始更改为崩溃 2022-01-17T16:20:30.611091+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ip-tracker-app.herokuapp.com request_id=a46f3082-43fd-45e9-a049-d1076cad194f fwd="2.125.111.225" dyno= connect= service= status=503 bytes= protocol=https 2022-01-17T16:20:31.020509+00:00 heroku[路由器]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ip-tracker-app.herokuapp.com request_id=c01ac432-ae1c-4994-9fa0-b211a8f00391 fwd="2.125. 111.225" dyno= 连接= 服务= 状态=503 字节= 协议=https

My Package.json file:我的 Package.json 文件:

{
  "name": "ip-address-tracker",
  "version": "1.0.0",
  "description": "*Removed for question*",
  "main": "index.js",
  "directories": {
    "test": "test"
  },
  "scripts": {
    "start": "node server.js",
    "test": "jest --coverage",
    "devStart": "nodemon server.js"
  },
  "jest": {
    "transform": {
      "^.+\\.[t|j]sx?$": "babel-jest"
    }
  },
  "repository": {
    "type": "git",
    "url": "*Removed for question*"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "*Removed for question*",
  },
  "homepage": "*Removed for question*",
  "dependencies": {
    "dotenv": "^10.0.0",
    "express": "^4.17.2",
    "jest": "^27.4.7",
    "serve": "^13.0.2"
  },
  "devDependencies": {
    "@babel/core": "^7.16.7",
    "@babel/preset-env": "^7.16.8",
    "babel-jest": "^27.4.6",
    "nodemon": "^2.0.15",
    "regenerator-runtime": "^0.13.9"
  }
}

My server.js file:我的 server.js 文件:

const express = require('express');
const app = express();
const dotenv = require('dotenv');
const result = dotenv.config();

if (result.error) {
    throw result.error;
}

const PORT = process.env.PORT || 3000;

app.use(express.static('public'));

app.listen(PORT, () => {
    console.log(`App is listening on ${PORT}.`);
});

I have added the following Procfile:我添加了以下 Procfile:

web: npm start

I saw an issue on your serveur if you want to serve html file like dist try this instead如果您想提供 html 文件,例如 dist,我在您的服务器上看到了一个问题,请尝试这个

app.use('/', serveStatic(path.join(__dirname, '/public')))

If the purpose is to deliver image如果目的是传递图像

app.use(express.static(path.join(__dirname,'public')))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 第一次将 Express 后端部署到 Heroku 2 错误代码 h10 进程以状态 1 退出 - First time deploying an express backend to Heroku 2 error code h10 Process exited with status 1 Heroku Node.js 应用程序“进程以状态 1 退出”和错误 h10 - Heroku Node.js app “Process exited with status 1” and error h10 Heroku 无法启动我的 app.js(代码 H10 状态 503) - Heroku Couldn't start my app.js (Code H10 status 503) 我正在尝试部署 Heroku,但出现此错误 - code = H10, desc = app crashed method=GET path="/" status=503 - I am trying to deploy Heroku and I am getting this error - code = H10, desc = app crashed method=GET path="/" status=503 Heroku Node.js 错误代码 H10“应用程序崩溃” - Heroku Node.js error code H10 "App crashed" 部署 Heroku 时应用程序崩溃(代码 h10) - App Crashing when Deploying Heroku (Code h10) 应用程序前端的 Heroku 应用程序崩溃 h10 错误 - Heroku app crash h10 error on app's frontend 当我打开 heroku 时,我遇到了带有 h10 代码的 Strapi 问题 - When i open heroku i have a problem with strapi with h10 code Heroku部署错误H10; 错误:找不到模块'/ app / console` - Heroku deployment error H10; Error: Cannot find module '/app/console` 将 JS 应用程序部署到 Heroku - 错误 H10 503 错误,应用程序崩溃 - Deploying JS app to Heroku - Error H10 503 error, app crashes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM