不断从部署到heroku的节点/角度应用程序中获取H10错误

时间:2018-11-01 18:16:12

标签: node.js angular heroku

我已经在heroku上部署了应用程序,并且它们可以正常工作。但是现在当我将应用程序部署到heroku时,我一直收到H10错误。我尝试了几种方法,但问题仍然存在。我已经更改了我的cli的版本,但是失败了。

这是procfile: web:节点server.js

这是package.json文件:


 {
  "name": "host",
  "version": "0.0.0",
   "license": "MIT",
   "scripts": {
      "ng": "ng",
      "start": "node server.js",
      "build": "ng build --prod",
       test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e"
  },
   "private": true,
   "dependencies": {
   "@angular/animations": "^5.2.0",
   "@angular/common": "^5.2.0",
   "@angular/compiler": "^5.2.0",
   "@angular/core": "^5.2.0",
   "@angular/forms": "^5.2.0",
   "@angular/http": "^5.2.0",
   "@angular/platform-browser": "^5.2.0",
   "@angular/platform-browser-dynamic": "^5.2.0",
   "@angular/router": "^5.2.0",
   "core-js": "^2.4.1",
   "express": "^4.16.4",
   "rxjs": "^5.5.6",
   "socket.io": "^2.1.1",
   "socket.io-client": "^2.1.1",
   "zone.js": "^0.8.19"
  },
 "devDependencies": {
  "@angular/cli": "~1.7.4",
  "@angular/compiler-cli": "^5.2.0",
  "@angular/language-service": "^5.2.0",
  "@types/jasmine": "~2.8.3",
  "@types/jasminewd2": "~2.0.2",
  "@types/node": "~6.0.60",
  "codelyzer": "^4.0.1",
  "jasmine-core": "~2.8.0",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~2.0.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "^1.2.1",
  "karma-jasmine": "~1.1.0",
  "karma-jasmine-html-reporter": "^0.2.2",
  "protractor": "~5.1.2",
  "ts-node": "~4.1.0",
  "tslint": "~5.9.1",
  "typescript": "~2.5.3"
 }
}

这是server.js文件

  const express = require('express');
  const path = require('path');
  const http = require('http');
  const socketIO = require('socket.io');

  const app = express();
  const port = process.env.PORT || 3000;


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

  app.get('*', (req, res) => {
      res.sendFile(path.join(__dirname, 'public/index.html'));

  });


 const server = http.createServer(app);
 const io = socketIO(server);


 // All socket mehtods
 io.on('connection', (socket) => {

   console.log("user connected");

   socket.on(`disconnect`, () => {
    console.log(`user disconnected ` + socket.id);
  });

  });
    server.listen(port, () => {
      console.log(`server running on port ${port} `);
   })

这是.git忽略文件代码     node_modules     npm-debug.log

我一直得到的错误是

2018-11-01T17:52:22.327377+00:00 app[api]: Deploy dbfb54c0 by user adil.sharif94@hotmail.com
2018-11-01T17:52:27.954066+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-01T17:52:27.956129+00:00 heroku[web.1]: State changed from crashed to starting
2018-11-01T17:52:27.940379+00:00 heroku[web.1]: Process exited with status 0
2018-11-01T17:52:33.336893+00:00 heroku[web.1]: Starting process with command `: node server.js`
2018-11-01T17:52:34.000000+00:00 app[api]: Build succeeded
2018-11-01T17:52:36.414282+00:00 heroku[web.1]: Process exited with status 0
2018-11-01T17:52:36.433554+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-01T17:53:34.518618+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-sierra-24713.herokuapp.com request_id=47f56b44-ca8d-4e53-ade3-9a68ae39387b fwd="39.40.104.115" dyno= connect= service= status=503 bytes= protocol=https
2018-11-01T17:53:35.891606+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=murmuring-sierra-24713.herokuapp.com request_id=92057ac3-cd35-4fef-af18-3a85ddf08814 fwd="39.40.104.115" dyno= connect= service= status=503 bytes= protocol=https

以前使用的angular cli版本是6.2.4。 这也是ng版本

Angular CLI: 1.7.4
Node: 8.11.3
OS: win32 x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

我尝试过的ng版本

Angular CLI: 6.1.5
Node: 8.11.3
OS: win32 x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.3.2
typescript                        2.7.2
webpack                           4.9.2

我不知道现在该怎么办。 谁能帮我。 预先感谢

0 个答案:

没有答案