2017-12-04 4 views
0

herokuでnode.jsアプリケーションを実行しようとしていますが、npm startを使用してherokuをローカルで使用していますherokuでホストされているときに実行されません。私は見つけることができたすべての解決策を見てきました。遠隔のmongodbデータベースは、npm startを使用して実行するとうまく動作し、ポートが正しく設定され、herokuとdynamosを何度も再起動しました。次のようなprocfileを持っています。herokuでのエラーR10(ブートタイムアウト)、npm startとherokuをローカルで使用して<5秒で動作する

web node index.js 

次は私が手コンソールメッセージです:

Starting process with command `node index.js` 
Warning: connect.session() MemoryStore is not 
designed for a production environment, as it will leak 
memory, and will not scale past a single process. 
Application ready to serve requests. 
Environment: production 
app[web.1]: (node:4) DeprecationWarning: `open()` is deprecated in 
mongoose >= 4.11.0, 
use `openUri()` instead, or set the `useMongoClient` option if using 
`connect()` 
or `createConnection()`. See 
http://mongoosejs.com/docs/connections.html#use-mongo-client 
Db.prototype.authenticate method will no longer be available in the 
next major 
release 3.x as MongoDB 3.6 will only allow auth against users in the 
admin db 
and will no longer allow multiple credentials on a socket. Please 
authenticate using MongoClient.connect with auth credentials. 
DB Connection Open... 
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 
60 seconds of launch 
Stopping process with SIGKILL 
Process exited with status 137 

これは私のpackage.jsonです:

{ 
    "name": "shop", 
    "version": "0.1.0", 
    "description": "eCommerce Site", 
    "author": "Slav Bugryn", 
    "main": "index.js", 
    "scripts": { 
    "test": "grunt test", 
    "build": "grunt build", 
    "all": "npm run build && npm run test", 
    "start": "node server.js" 
    }, 
    "dependencies": { 
    "connect-flash": "^0.1.1", 
    "construx": "^1.0.0", 
    "construx-copier": "^1.0.0", 
    "construx-dustjs": "^1.1.0", 
    "construx-less": "^1.0.0", 
    "dust-makara-helpers": "^4.2.0", 
    "dustjs-helpers": "^1.7.3", 
    "eslint": "^4.12.1", 
    "express": "^4.12.2", 
    "express-messages": "^1.0.1", 
    "kraken-js": "^2.0.0", 
    "makara": "^2.0.3", 
    "mongodb": "^2.2.33", 
    "mongoose": "^4.13.6", 
    "requirejs": "^2.3.5" 
    }, 
    "devDependencies": { 
    "grunt": "^1.0.1", 
    "grunt-cli": "^1.2.0", 
    "grunt-config-dir": "^0.3.2", 
    "grunt-contrib-clean": "^1.1.0", 
    "grunt-contrib-less": "^1.4.1", 
    "grunt-contrib-requirejs": "^1.0.0", 
    "grunt-copy-to": "0.0.12", 
    "grunt-dustjs": "^1.4.0", 
    "grunt-eslint": "^20.1.0", 
    "grunt-makara-amdify": "^1.0.1", 
    "grunt-mocha-cli": "^3.0.0", 
    "mocha": "^4.0.1", 
    "supertest": "^3.0.0" 
    }, 
    "directories": { 
    "lib": "lib", 
    "test": "test" 
    }, 
    "keywords": [], 
    "license": "ISC" 
} 

何かアドバイスが大幅に、内おかげでいただければ幸いです 前進。

+0

あなたはheroku 'process.env.PORT'の環境変数にバインドするようにあなたのポートを設定しましたか? –

+0

私は以下を含むserver.jsファイルを持っています: \t 'server = http.createServer(app); \t server.listen(process.env.PORT || 8000); \t server.on( 'リスニング'、関数(){ \tはconsole.log( 'HTTPをリッスンサーバー:// localhostを:%のD'、 this.address()ポート); \t}); ' ご返信ありがとうございます。 – SBugryn

+0

このエラーが発生しました: 'at =エラーコード= H20 desc =" Appブートタイムアウト "method = GET path ="/"' – SBugryn

答えて

0

Procfileを間違った場所に送ってしまった(server.jsに行って、package.jsonを見て見つけ出し、スクリプトの下で見つけ出す必要がありました)、別のエラーがあったことを修正した後(ここでも同じです修正:Got a internal server error after I deploy my node js project to the host)は、私が修正プログラムを実行することで修正されました(--forceも使用しなければなりませんでした)。

関連する問題