繁体   English   中英

CSS 和 JS 文件离线加载,但在 Heroku 上部署时不加载

[英]CSS and JS files loading offline but not when deployed on Heroku

我在将应用程序部署到 Heroku 时遇到了麻烦。 构建成功,但由于某种原因,我的应用程序没有在线检索 CSS 或 JS 文件。 我正在使用 Node.js。

2015-12-23T02:31:28.107602+00:00 heroku[api]: Release v174 created by averybentz@bell.net
2015-12-23T02:31:28.249227+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:31:28.249232+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:31:28.399932+00:00 heroku[web.1]: State changed from up to starting
2015-12-23T02:31:29.599898+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:31:31.936570+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T02:31:35.233051+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T02:31:38.666073+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T02:31:43.695902+00:00 heroku[router]: at=info method=GET path="/" host=allert.herokuapp.com request_id=22c9274d-bf9d-4923-b698-95814e83b2d6 fwd="142.113.215.26" dyno=web.1 connect=1ms service=30ms status=304 bytes=146
2015-12-23T02:31:43.772913+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=10519bb7-dae8-496a-b1b2-3a846ebe8a0c fwd="142.113.215.26" dyno=web.1 connect=1ms service=39ms status=404 bytes=220
2015-12-23T02:31:43.757781+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=a74736e9-1265-440b-9253-04b0460a620c fwd="142.113.215.26" dyno=web.1 connect=1ms service=19ms status=404 bytes=225
2015-12-23T02:34:06.094848+00:00 heroku[api]: Deploy 1b0351b by averybentz@bell.net
2015-12-23T02:34:06.094848+00:00 heroku[api]: Release v175 created by averybentz@bell.net
2015-12-23T02:34:06.227485+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:34:06.227495+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:34:07.634148+00:00 heroku[web.1]: State changed from up to starting
2015-12-23T02:34:08.607774+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:10.543910+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:10.543951+00:00 app[web.1]:     throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:10.543963+00:00 app[web.1]:     ^
2015-12-23T02:34:10.543974+00:00 app[web.1]: 
2015-12-23T02:34:10.543986+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:10.543988+00:00 app[web.1]:     at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:10.543987+00:00 app[web.1]:     at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:10.543989+00:00 app[web.1]:     at Module._compile (module.js:425:26)
2015-12-23T02:34:10.543989+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:10.543990+00:00 app[web.1]:     at Module.load (module.js:356:32)
2015-12-23T02:34:10.543990+00:00 app[web.1]:     at Function.Module._load (module.js:313:12)
2015-12-23T02:34:10.543991+00:00 app[web.1]:     at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:10.543992+00:00 app[web.1]:     at startup (node.js:138:18)
2015-12-23T02:34:10.544003+00:00 app[web.1]:     at node.js:974:3
2015-12-23T02:34:11.273463+00:00 heroku[web.1]: State changed from starting to crashed
2015-12-23T02:34:11.274404+00:00 heroku[web.1]: State changed from crashed to starting
2015-12-23T02:34:11.249687+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:12.195648+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T02:34:12.163995+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:14.005248+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T02:34:14.208032+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:14.208060+00:00 app[web.1]:     throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:14.208062+00:00 app[web.1]:     ^
2015-12-23T02:34:14.208063+00:00 app[web.1]: 
2015-12-23T02:34:14.208067+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:14.208068+00:00 app[web.1]:     at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:14.208069+00:00 app[web.1]:     at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:14.208069+00:00 app[web.1]:     at Module._compile (module.js:425:26)
2015-12-23T02:34:14.208070+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:14.208070+00:00 app[web.1]:     at Module.load (module.js:356:32)
2015-12-23T02:34:14.208071+00:00 app[web.1]:     at Function.Module._load (module.js:313:12)
2015-12-23T02:34:14.208071+00:00 app[web.1]:     at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:14.208072+00:00 app[web.1]:     at startup (node.js:138:18)
2015-12-23T02:34:14.208073+00:00 app[web.1]:     at node.js:974:3
2015-12-23T02:34:14.997397+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:16.318032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=allert.herokuapp.com request_id=21b5b175-c8c3-4338-b1ff-073c55ff4dac fwd="142.113.215.26" dyno= connect= service= status=503 bytes=
2015-12-23T02:34:15.054571+00:00 heroku[web.1]: State changed from starting to crashed
2015-12-23T02:34:46.713402+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:34:46.713411+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:34:46.577987+00:00 heroku[api]: Deploy c6fd6f1 by averybentz@bell.net
2015-12-23T02:34:46.577987+00:00 heroku[api]: Release v176 created by averybentz@bell.net
2015-12-23T02:34:46.701946+00:00 heroku[web.1]: State changed from crashed to starting
2015-12-23T02:34:47.557807+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:50.042760+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T03:07:57.567678+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T03:07:59.713608+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T03:07:53.346047+00:00 heroku[web.1]: Idling
2015-12-23T03:07:53.346422+00:00 heroku[web.1]: State changed from up to down
2015-12-23T16:22:11.989654+00:00 heroku[api]: Starting process with command `rake db:migrate` by averybentz@bell.net
2015-12-23T16:22:13.750043+00:00 heroku[run.2637]: Starting process with command `rake db:migrate`
2015-12-23T16:22:13.713201+00:00 heroku[run.2637]: Awaiting client
2015-12-23T16:22:14.013741+00:00 heroku[run.2637]: State changed from starting to up
2015-12-23T16:22:16.241635+00:00 heroku[run.2637]: State changed from up to complete
2015-12-23T16:22:16.224832+00:00 heroku[run.2637]: Process exited with status 127
2015-12-23T16:23:12.741395+00:00 heroku[api]: Starting process with command `rake db:migrate` by averybentz@bell.net
2015-12-23T16:23:13.915645+00:00 heroku[run.8207]: Awaiting client
2015-12-23T16:23:13.936338+00:00 heroku[run.8207]: Starting process with command `rake db:migrate`
2015-12-23T16:23:14.252137+00:00 heroku[run.8207]: State changed from starting to up
2015-12-23T16:23:15.489691+00:00 heroku[run.8207]: Process exited with status 127
2015-12-23T16:23:15.526095+00:00 heroku[run.8207]: State changed from up to complete
2015-12-23T16:27:33.180438+00:00 heroku[api]: Deploy f63f788 by averybentz@bell.net
2015-12-23T16:27:33.180438+00:00 heroku[api]: Release v177 created by averybentz@bell.net
2015-12-23T16:27:33.322549+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T16:27:33.322560+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T20:34:47.337524+00:00 heroku[api]: Deploy fc8a2a6 by averybentz@bell.net
2015-12-23T20:34:47.337524+00:00 heroku[api]: Release v178 created by averybentz@bell.net
2015-12-23T20:34:47.477567+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T20:34:47.477591+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T20:34:56.089225+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T20:34:55.197826+00:00 heroku[web.1]: Unidling
2015-12-23T20:34:55.198252+00:00 heroku[web.1]: State changed from down to starting
2015-12-23T20:34:58.238986+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T20:34:59.290400+00:00 heroku[router]: at=info method=GET path="/" host=allert.herokuapp.com request_id=3c539404-e0bc-4878-b856-ccfaea4559d6 fwd="142.113.215.26" dyno=web.1 connect=2ms service=22ms status=200 bytes=1892
2015-12-23T20:34:59.370781+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=24115a3e-f28f-46b3-b49d-2dd75ff4ea80 fwd="142.113.215.26" dyno=web.1 connect=4ms service=7ms status=404 bytes=225
2015-12-23T20:34:59.352933+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=8635dc7c-8dab-4518-9d93-c108a5a7274f fwd="142.113.215.26" dyno=web.1 connect=2ms service=7ms status=404 bytes=220
2015-12-23T20:35:06.061489+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=b2e00361-7561-4a5d-86c3-bfbd445c1195 fwd="142.113.215.26" dyno=web.1 connect=2ms service=2ms status=404 bytes=225
2015-12-23T20:35:06.073592+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=77220e8e-d7f3-486b-8240-122ff34d28d5 fwd="142.113.215.26" dyno=web.1 connect=2ms service=3ms status=404 bytes=220
2015-12-23T20:35:06.026126+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=a0d0909c-1dd8-4d5f-985b-23c8d15eb972 fwd="142.113.215.26" dyno=web.1 connect=16ms service=8ms status=200 bytes=1892
2015-12-23T20:35:06.671874+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=d44efef6-7ed5-4fa5-b9cb-5be321054272 fwd="142.113.215.26" dyno=web.1 connect=5ms service=4ms status=404 bytes=225
2015-12-23T20:35:06.603304+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=e048945d-f7cc-4737-bc15-54ff205e7a27 fwd="142.113.215.26" dyno=web.1 connect=2ms service=4ms status=304 bytes=146
2015-12-23T20:35:06.649798+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=ecfbf3d9-e6d4-41e6-a98b-60a4bb42d1a0 fwd="142.113.215.26" dyno=web.1 connect=2ms service=5ms status=404 bytes=220
2015-12-23T20:35:07.283559+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=f786f940-c163-45a0-87f1-2e40681d1a44 fwd="142.113.215.26" dyno=web.1 connect=2ms service=3ms status=304 bytes=146
2015-12-23T20:35:07.336974+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=7fd25be7-7030-4f7b-a974-410185d5ed36 fwd="142.113.215.26" dyno=web.1 connect=11ms service=3ms status=404 bytes=220
2015-12-23T20:35:07.314908+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=a522768d-5171-4300-a435-c6669326015b fwd="142.113.215.26" dyno=web.1 connect=2ms service=2ms status=404 bytes=225

我假设 Heroku 对 src 文件或类似的东西有一定的安全性。 任何帮助,将不胜感激。 提前致谢。

您的应用在此处存在错误:

2015-12-23T02:34:14.208032+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:14.208060+00:00 app[web.1]:     throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:14.208062+00:00 app[web.1]:     ^
2015-12-23T02:34:14.208063+00:00 app[web.1]: 
2015-12-23T02:34:14.208067+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:14.208068+00:00 app[web.1]:     at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:14.208069+00:00 app[web.1]:     at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:14.208069+00:00 app[web.1]:     at Module._compile (module.js:425:26)
2015-12-23T02:34:14.208070+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:14.208070+00:00 app[web.1]:     at Module.load (module.js:356:32)
2015-12-23T02:34:14.208071+00:00 app[web.1]:     at Function.Module._load (module.js:313:12)
2015-12-23T02:34:14.208071+00:00 app[web.1]:     at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:14.208072+00:00 app[web.1]:     at startup (node.js:138:18)
2015-12-23T02:34:14.208073+00:00 app[web.1]:     at node.js:974:3
2015-12-23T02:34:14.997397+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:16.318032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=allert.herokuapp.com request_id=21b5b175-c8c3-4338-b1ff-073c55ff4dac fwd="142.113.215.26" dyno= connect= service= status=503 bytes=
2015-12-23T02:34:15.054571+00:00 heroku[web.1]: State changed from starting to crashed

检查 index.js 文件的第 8 行。 它传递一些东西来表达表达不理解的东西。

Heroku 不显示静态文件。 我将它们托管在 Amazon S3 上,该站点现在正在运行。

暂无
暂无

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

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