2016-11-25 13 views
0

Rails5アプリにAngular2をデプロイすると、エラーなしで正常にビルドできました。私はその後、問題なくPGデータベースをセットアップします。アプリにアクセスしようとすると、私はHerokuアプリケーションログから以下のスタックトレースを取得します。 npm:コマンドが見つからない理由を理解しようとしています。Angular 2 + Rails 5 Herokuデプロイメントエラー(bash:npm:コマンドが見つかりません)

2016-11-25T00:30:40.044683+00:00 heroku[web.1]: State changed from 
crashed to starting 
2016-11-25T00:30:52.371722+00:00 heroku[web.1]: Starting process with 
command `npm start` 
2016-11-25T00:30:55.294652+00:00 app[web.1]: bash: npm: command not 
found 
2016-11-25T00:30:55.439571+00:00 heroku[web.1]: State changed from 
starting to crashed 
2016-11-25T00:30:55.409349+00:00 heroku[web.1]: Process exited with 
status 127 

package.jsonヘッド

{ 
"name": "raven", 
"version": "0.0.1", 
"license": "MIT", 
"angular-cli": {}, 
"scripts": { 
    "start": "ng serve --proxy-config proxy.conf.json", 
    "start-phone": "ng serve --proxy-config proxy.conf.json --host 
    0.0.0.0", 
    "lint": "tslint \"src/**/*.ts\"", 
    "test": "ng test", 
    "pree2e": "webdriver-manager update", 
    "e2e": "protractor", 
    "heroku-postbuild": "ng build --prod" 
}, 

アプリケーションのURLをヒットしようとすると、Herokuのアプリログは以下のエラーコードをスロー:

2016-11-25T00:35:43.573863+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/" host=shrouded-shelf- 
15670.herokuapp.com request_id=92fba3d2-08e4-479d-8484-33f093c9c823 
fwd="75.173.239.214" dyno= connect= service= status=503 bytes= 

更新:私はにProcfileを追加しましたプロジェクトのルートディレクトリに以下のエントリを追加します。レールアプリはエントリの結果として起動しますが、まだbash:npm:commandが見つかりません。

Procfile:

web: sh -c 'cd ./client/ && exec npm start' 
api: rails s -p 3000 

残りのエラー:Herokuのポストビルドステップの間にAngular2アプリを起動するために考慮するため

2016-11-25T02:17:14.955048+00:00 heroku[web.1]: Starting process with 
command `sh -c 'cd ./client/ && exec npm start'` 
2016-11-25T02:17:17.066308+00:00 heroku[web.1]: Process exited with 
status 127 
2016-11-25T02:17:16.983254+00:00 app[web.1]: sh: 1: exec: npm: not 
found 
2016-11-25T02:17:17.078868+00:00 heroku[web.1]: State changed from 
starting to crashed 

答えて

0

修正package.json。 & &の後にそれを保持すると、前のステップが完了した場合にのみキックオフされます。

"heroku-postbuild": "ng build --prod && npm start" 
関連する問題