简体   繁体   English

无法在Heroku上部署网站/ Web应用程序

[英]Trouble Deploying a Website/Web App on Heroku

I am trying to deploy a web app on Heroku and it keeps crashing. 我正在尝试在Heroku上部署Web应用程序,但它一直崩溃。

After checking the logs, it says it crashed right before starting process with command 'node app.js' 检查日志后,它说它在starting process with command 'node app.js'之前就崩溃了

After pushing my app to Heroku Git, I clicked on the link and it gave me a missing script: start . 将我的应用程序推送到Heroku Git之后,我单击了链接,它给了我一个missing script: start

I added "start": "index.js" to my scripts, replacing the test and return 1 string . 我在脚本中添加了"start": "index.js" ,替换了测试并return 1 string

Now, I'm getting a different application error. 现在,我遇到了另一个应用程序错误。

Here are the logs: 以下是日志:

2019-04-16T15:55:19.291517+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-04-16T15_55_19_283Z-debug.log
2019-04-16T15:55:22.076257+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T15:55:24.008573+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T15:55:24.034855+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T15:55:23.952515+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T15:55:23.958426+00:00 app[web.1]:
2019-04-16T15:55:23.958664+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T15:55:23.958754+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-04-16T15_55_23_953Z-debug.log
2019-04-16T16:19:04.974643+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:19:08.471350+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T16:19:10.946953+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:19:10.920954+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:19:10.847576+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T16:19:10.856940+00:00 app[web.1]:
2019-04-16T16:19:10.862276+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T16:19:10.862279+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-04-16T16_19_10_849Z-debug.log
2019-04-16T16:21:52.000000+00:00 app[api]: Build started by user bsautry@ualr.edu
2019-04-16T16:22:14.048093+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:22:13.644927+00:00 app[api]: Release v4 created by user bsautry@ualr.edu
2019-04-16T16:22:13.644927+00:00 app[api]: Deploy 69b62110 by user bsautry@ualr.edu
2019-04-16T16:22:17.615771+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:22:18.000000+00:00 app[api]: Build succeeded
2019-04-16T16:22:20.049173+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:22:20.067122+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:22:19.975525+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:22:19.975544+00:00 app[web.1]: throw err;
2019-04-16T16:22:19.975546+00:00 app[web.1]: ^
2019-04-16T16:22:19.975548+00:00 app[web.1]:
2019-04-16T16:22:19.975549+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:22:19.975551+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:22:19.975553+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:22:19.975555+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:22:19.975557+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:22:19.975559+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:25:54.162474+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=589c1650-a614-4aae-a8e5-ffb58a523e1e fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:25:54.759301+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=3c7f8d06-e415-48ae-952d-3968d12db75c fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:30:55.410784+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:30:58.687945+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:31:01.064389+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:31:00.983841+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:31:00.983863+00:00 app[web.1]: throw err;
2019-04-16T16:31:00.983865+00:00 app[web.1]: ^
2019-04-16T16:31:00.983866+00:00 app[web.1]:
2019-04-16T16:31:00.983868+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:31:00.983870+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:31:00.983872+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:31:00.983873+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:31:00.983874+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:31:00.983875+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:31:01.040784+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:14.705641+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:59:18.023601+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:59:20.925080+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:59:20.905853+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:20.804107+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:59:20.804145+00:00 app[web.1]: throw err;
2019-04-16T16:59:20.804147+00:00 app[web.1]: ^
2019-04-16T16:59:20.804149+00:00 app[web.1]:
2019-04-16T16:59:20.804150+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:59:20.804153+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:59:20.804155+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:59:20.804156+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:59:20.804158+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:59:20.804159+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:37:18.987655+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=1fc71b49-e1f4-4e23-b898-9d77035b5e04 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:37:19.514237+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a9886709-5ec0-49da-adfd-0c02d8378903 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:45:46.000000+00:00 app[api]: Build started by user bsautry@ualr.edu
2019-04-16T17:46:08.863208+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:08.459037+00:00 app[api]: Release v5 created by user bsautry@ualr.edu
2019-04-16T17:46:08.459037+00:00 app[api]: Deploy 9cfd1de3 by user bsautry@ualr.edu
2019-04-16T17:46:12.241604+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:13.000000+00:00 app[api]: Build succeeded
2019-04-16T17:46:14.898819+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:14.914929+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:14.882816+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:14.816039+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:14.816072+00:00 app[web.1]: throw err;
2019-04-16T17:46:14.816074+00:00 app[web.1]: ^
2019-04-16T17:46:14.816076+00:00 app[web.1]:
2019-04-16T17:46:14.816078+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:14.816080+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:14.816081+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:14.816083+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:14.816084+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:14.816086+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:19.195129+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:22.064061+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:22.040652+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:21.962948+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:21.962978+00:00 app[web.1]: throw err;
2019-04-16T17:46:21.962980+00:00 app[web.1]: ^
2019-04-16T17:46:21.962981+00:00 app[web.1]:
2019-04-16T17:46:21.962983+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:21.962985+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:21.962987+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:21.962989+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:21.962991+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:21.962992+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:22.320545+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=a8e86470-1fee-4159-a683-a4437e46ccbc fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:46:23.689417+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a7e1403a-3ee9-490f-9446-b4d8150761ee fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:56.610263+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=fac4cd8f-dfce-4023-bc1d-e27e3297cd59 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:57.055698+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=b431c26e-62c1-42ca-908d-bbe70be171e4 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https

I expect it will be some sort of file naming issue. 我希望这将是某种文件命名问题。

Well, according to your error messages Error: Cannot find module '/app/app.js' 好吧,根据您的错误消息Error: Cannot find module '/app/app.js'

I believe it is trying to find your app.js which is I guess it should be your index.js. 我相信它正在尝试找到您的app.js,我想它应该是您的index.js。 What exactly are you using? 您到底在用什么? Angular? 角? If so, check this link as it helped me to understand how to set up an angular project to deploy to heroku. 如果是这样,请检查此链接,因为它有助于我理解如何设置一个角度项目以部署到heroku。

https://medium.com/@hellotunmbi/how-to-deploy-angular-application-to-heroku-1d56e09c5147 https://medium.com/@hellotunmbi/how-to-deploy-angular-application-to-heroku-1d56e09c5147

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM