2017-12-01 9 views
0

私はNodeJSで記述され、Herokuに展開される単一ページアプリケーションを持っています。herokuのファイルが見つかりません

私は同じように私Procfileを定義します。

ウェブ:PORT = $ PORTのWebPACK -p --config ./config/webpack/serverProd.js --progress & &ノード./dist/server.js

heroku-postbuild deployフックを使用しないのは、Herokuが動的に割り当てたPORT変数を取得できないためです。これがPORT変数にアクセスする唯一の方法です。

しかし、私はheroku run bashを実行し、Herokuのの容器の中に周りの検索...ダTA

私はserver.jsが存在するはずですが、/app/dist/ディレクトリに見つかりませんでした。

私はかなり誤解していると確信しています。誰もそれを指摘できますか?

本当にありがとうございます!

+0

あなたのアプリログをHerokuでチェックしましたか? – oneturkmen

+0

@oneturkmenはい私は自分のログをチェックする。実際、 'heroku logs -t 'を使って'/app/dist/server.js'にあるエラーメッセージを表示することができます。しかし、私はまだファイルserver.jsを見つけることができません。私のログにチェックできる他の手がかりはありますか? – fung

答えて

0

これは私のセットアップHerokuの上のNPMプロジェクト\私のnodejsが

Procfile

web: npm run build && node dist/index.js 

package.json

"scripts": { 
    "clean": "rm -rf dist && mkdir dist", 
    "serve": "node dist/index.js", 
    "start": "nodemon --inspect src/index.js --exec babel-node", 
    "build": "npm run clean && npm run build-server", 
    "build-server": "babel src -d dist", 
    "test": "mocha --compilers js:babel-register" 
    }, 

代わりにserver.js/distのからアプリを起動してください方法です./dist/server.js

関連する問題