Angular e heroku

Quando clico no link, mostra este erro:

2020-06-02T20:58:06.216437+00:00 heroku[web.1]: Starting process with command `npm start`
2020-06-02T20:58:08.832352+00:00 heroku[web.1]: Process exited with status 1
2020-06-02T20:58:08.878842+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-02T20:58:08.729034+00:00 app[web.1]:
2020-06-02T20:58:08.729053+00:00 app[web.1]: > xxxxxxx@0.0.0 start /app
2020-06-02T20:58:08.729054+00:00 app[web.1]: > ng serve
2020-06-02T20:58:08.729054+00:00 app[web.1]:
2020-06-02T20:58:08.747226+00:00 app[web.1]: sh: 1: ng: not found
2020-06-02T20:58:08.750860+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-02T20:58:08.751190+00:00 app[web.1]: npm ERR! syscall spawn
2020-06-02T20:58:08.751289+00:00 app[web.1]: npm ERR! file sh
2020-06-02T20:58:08.751481+00:00 app[web.1]: npm ERR! errno ENOENT
2020-06-02T20:58:08.752318+00:00 app[web.1]: npm ERR! xxxxxxx@0.0.0 start: `ng serve`
2020-06-02T20:58:08.752400+00:00 app[web.1]: npm ERR! spawn ENOENT
2020-06-02T20:58:08.752497+00:00 app[web.1]: npm ERR!
2020-06-02T20:58:08.752587+00:00 app[web.1]: npm ERR! Failed at the xxxxxxx@0.0.0 start script.
2020-06-02T20:58:08.752665+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-02T20:58:08.760554+00:00 app[web.1]:
2020-06-02T20:58:08.760745+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-02T20:58:08.760851+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-06-02T20_58_08_753Z-debug.log
2020-06-02T20:58:09.708015+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxx.herokuapp.com request_id=b580aed9-e66c-4cf8-a901-bbf8acc90ed6 fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https
2020-06-02T20:58:11.255910+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxxxx.herokuapp.com request_id=faf5dea1-2366-418d-b198-e2ef7abdefd9 fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https
2020-06-02T20:58:31.200035+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxxxx.herokuapp.com request_id=057625c2-3cb5-4682-bac3-868e181d036f fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https
2020-06-02T20:58:31.855324+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxxxx.herokuapp.com request_id=08a7cfc4-8316-437b-abe0-6c681b787f39 fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https

package.json

{
  "name": "xxxxxxx",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "heroku-postbuild": "ng build --prod"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.0.6",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "~9.0.6",
    "@angular/compiler": "~9.0.6",
    "@angular/core": "~9.0.6",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "~9.0.6",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~9.0.6",
    "@angular/platform-browser-dynamic": "~9.0.6",
    "@angular/router": "~9.0.6",
    "angular2-text-mask": "^9.0.0",
    "jquery": "^3.5.1",
    "ngx-perfect-scrollbar": "^9.0.0",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.6",
    "@angular/cli": "~9.0.6",
    "@angular/compiler-cli": "~9.0.6",
    "@angular/language-service": "~9.0.6",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "~3.7.5"
  },
  "engines": {
    "node": "13.12.0",
    "npm": "6.14.4"
  }
}

O que pode ser ?

Não achou o comando ng. Parece que precisa instalar o angular-cli. Pena que nunca usei o heroku, senão te ajudava melhor.

Tem uma boa explicação nesse link: https://stackoverflow.com/questions/46885249/heroku-deploy-issue-sh-1-ng-not-found

Tem uma solução aqui tb: https://github.com/angular/angular-cli/issues/7550

Pelo que entendi, só faltava isso:
"postinstall": “ng build --prod”,

Isso “heroku-postbuild”: “ng build --prod”, já tinha

Depois deu erro em outras, ajustei

Agora não sai disso

2020-06-02T23:56:37.863896+00:00 app[web.1]: 0: ExitFrame [pc: 0x13d8b79]
2020-06-02T23:56:37.863897+00:00 app[web.1]: 1: StubFrame [pc: 0x1448eb9]
2020-06-02T23:56:37.863897+00:00 app[web.1]: Security context: 0x2165f6ec0921 <JSObject>
2020-06-02T23:56:37.863899+00:00 app[web.1]: 2: checkTypeRelatedTo(aka checkTypeRelatedTo) [0x258e2aebc731] [/app/node_modules/typescript/lib/typescript.js:1] [bytecode=0x21287c21a0a1 offset=0](this=0x1b6284ec04b9 <undefined>,0x36a8155da529 <TypeObject map = 0x1688ced346f1>,0x2022e9ed9069 <TypeObject map = 0x1688ced34b01>,0x258e2aeb3591 <Map map = 0x3adbbc500f31>,0x1b628...
2020-06-02T23:56:37.863899+00:00 app[web.1]:
2020-06-02T23:56:37.863907+00:00 app[web.1]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
2020-06-02T23:56:37.864531+00:00 app[web.1]: 1: 0xa0c020 node::Abort() [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.864972+00:00 app[web.1]: 2: 0xa0c42d node::OnFatalError(char const*, char const*) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.865502+00:00 app[web.1]: 3: 0xb8130e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.865958+00:00 app[web.1]: 4: 0xb81689 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.866498+00:00 app[web.1]: 5: 0xd2fb95  [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.867037+00:00 app[web.1]: 6: 0xd30226 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.867573+00:00 app[web.1]: 7: 0xd3ea99 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.868128+00:00 app[web.1]: 8: 0xd3f8d5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.868668+00:00 app[web.1]: 9: 0xd423ac v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.869199+00:00 app[web.1]: 10: 0xd08f84 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.869841+00:00 app[web.1]: 11: 0x105532e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.870508+00:00 app[web.1]: 12: 0x13d8b79  [ng serve --port 24761 --host 0.0.0.0]
2020-06-02T23:56:37.903983+00:00 app[web.1]: Aborted
2020-06-02T23:56:37.906699+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-02T23:56:37.907079+00:00 app[web.1]: npm ERR! errno 134
2020-06-02T23:56:37.907996+00:00 app[web.1]: npm ERR! xxxxxx@0.0.0 start: `ng serve --port $PORT --host 0.0.0.0`
2020-06-02T23:56:37.908162+00:00 app[web.1]: npm ERR! Exit status 134
2020-06-02T23:56:37.908331+00:00 app[web.1]: npm ERR!
2020-06-02T23:56:37.908515+00:00 app[web.1]: npm ERR! Failed at the xxxx@0.0.0 start script.
2020-06-02T23:56:37.908677+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-02T23:56:37.916760+00:00 app[web.1]:
2020-06-02T23:56:37.916962+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-02T23:56:37.917082+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-06-02T23_56_37_909Z-debug.log
2020-06-02T23:56:37.972443+00:00 heroku[web.1]: Process exited with status 134
2020-06-02T23:56:38.015897+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-02T23:56:39.997710+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxx.herokuapp.com request_id=c8867c7b-945c-4628-be01-dd861d7edaa4 fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https
2020-06-02T23:56:41.411899+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxx.herokuapp.com request_id=347d2dcd-76b6-4fb5-b437-9a6aebe88f3c fwd="191.185.120.103" dyno= connect= service= status=503 bytes= protocol=https

package.json

{
  "name": "correios",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --port $PORT --host 0.0.0.0",
    "build": "ng build --prod --aot",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ng build --aot --prod"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "~0.900.6",
    "@angular/cli": "~9.0.6",
    "@angular/compiler-cli": "~9.0.6",
    "@angular/animations": "~9.0.6",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "~9.0.6",
    "@angular/compiler": "~9.0.6",
    "@angular/core": "~9.0.6",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "~9.0.6",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~9.0.6",
    "@angular/platform-browser-dynamic": "~9.0.6",
    "@angular/router": "~9.0.6",
    "angular2-text-mask": "^9.0.0",
    "jquery": "^3.5.1",
    "ngx-perfect-scrollbar": "^9.0.0",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2",
    "typescript": "~3.7.5"
  },
  "devDependencies": {
    "@angular/language-service": "~9.0.6",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0"
  },
  "engines": {
    "node": "13.12.0",
    "npm": "6.14.4"
  }
}

O que pode ser ?

Veja se tu consegue ver esse log: /app/.npm/_logs/2020-06-02T23_56_37_909Z-debug.log

Não estou conseguindo

Vc sabe de algum lugar mais prático ? kkk

Não tenho bom conhecimento com heroku não, mas achei isso no site deles: https://devcenter.heroku.com/articles/logging

tentei também com este link, mas não consegui. As vezes não sei o comando

A um tempo atras eu publiquei lá mas não deu essa trabalheira.

Tenta tirar o “–aot” do postinstall, deixa assim:

"postinstall": "ng build --prod"

Não adiantou

2020-06-03T14:28:35.564383+00:00 app[web.1]: 21: 0x13d8b79  [ng serve --port 53150 --host 0.0.0.0]
2020-06-03T14:28:35.586075+00:00 app[web.1]: Aborted
2020-06-03T14:28:35.588709+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-03T14:28:35.588995+00:00 app[web.1]: npm ERR! errno 134
2020-06-03T14:28:35.589842+00:00 app[web.1]: npm ERR! correios@0.0.0 start: `ng serve --port $PORT --host 0.0.0.0`
2020-06-03T14:28:35.589949+00:00 app[web.1]: npm ERR! Exit status 134
2020-06-03T14:28:35.590050+00:00 app[web.1]: npm ERR!
2020-06-03T14:28:35.590139+00:00 app[web.1]: npm ERR! Failed at the correios@0.0.0 start script.
2020-06-03T14:28:35.590209+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-03T14:28:35.857974+00:00 app[web.1]:
2020-06-03T14:28:35.858174+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-03T14:28:35.858262+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-06-03T14_28_35_590Z-debug.log

Já tentou um “ng build --prod” local para ver se não tem nem um erro.

Mostrou isso no console

chunk {0} runtime-es2015.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]      
chunk {0} runtime-es5.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]
chunk {2} polyfills-es2015.1f913f16a2d346cc8bdc.js (polyfills) 36.1 kB [initial] [rendered]
chunk {3} polyfills-es5.1a3c78b07cd6f16c6e9a.js (polyfills-es5) 129 kB [initial] [rendered]
chunk {1} main-es2015.e0b4355d527bf4a77f4e.js (main) 1.19 MB [initial] [rendered]
chunk {1} main-es5.e0b4355d527bf4a77f4e.js (main) 1.34 MB [initial] [rendered]
chunk {4} styles.7c388d4064b5719ca43c.css (styles) 356 kB [initial] [rendered]
Date: 2020-06-03T18:39:26.844Z - Hash: 6611f7233eb5420c9dba - Time: 113917ms

Estou correto ?

Cara, tenta aumentar a memoria para o Node. Sei lá, se o máximo que você tem disponível for 512, coloque uns 384.

set NODE_OPTIONS=--max_old_space_size=384

Edit:
Andei pesquisando sobre isso, aparentemente 512mb é o valor default. Então, coloque um valor maior tipo: set NODE_OPTIONS=--max_old_space_size=8192.
Isso fará que, caso a memoria física disponível não seja suficiente, seja usado a memoria virtual do SO (SWAP) porém, isso é bem mais lento. Mas vale a pena tentar.