heroku local web
工作正常,但heroku open
正在抛出应用程序错误。
我检查了日志文件。 它说:找不到模块webpack。 完整的日志文件。
Niteshs-MacBook-Pro:nyps nitesh$ heroku logs --tail
2016-06-16T03:40:53.132495+00:00 heroku[api]: Enable Logplex by nitesh@campusdiaries.com
2016-06-16T03:40:53.132551+00:00 heroku[api]: Release v2 created by nitesh@campusdiaries.com
2016-06-16T03:45:07.332337+00:00 heroku[api]: Deploy 690eea8 by nitesh@campusdiaries.com
2016-06-16T03:45:07.332405+00:00 heroku[api]: Release v3 created by nitesh@campusdiaries.com
2016-06-16T03:45:07.331714+00:00 heroku[api]: Scale to web=1 by nitesh@campusdiaries.com
2016-06-16T03:45:07.704674+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-16T03:45:07.704663+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-16T03:45:14.763803+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-06-16T03:45:17.000120+00:00 app[web.1]: module.js:341
2016-06-16T03:45:17.000129+00:00 app[web.1]: throw err;
2016-06-16T03:45:17.000135+00:00 app[web.1]:
2016-06-16T03:45:17.000135+00:00 app[web.1]: ^
2016-06-16T03:45:17.000140+00:00 app[web.1]: Error: Cannot find module 'webpack'
2016-06-16T03:45:17.000141+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:339:15)
2016-06-16T03:45:17.000141+00:00 app[web.1]: at Function.Module._load (module.js:290:25)
2016-06-16T03:45:17.000142+00:00 app[web.1]: at Module.require (module.js:367:17)
2016-06-16T03:45:17.000142+00:00 app[web.1]: at require (internal/module.js:20:19)
2016-06-16T03:45:17.000143+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:77)
2016-06-16T03:45:17.000144+00:00 app[web.1]: at Object.Module._extensions..js (module.js:422:10)
2016-06-16T03:45:17.000144+00:00 app[web.1]: at Module._compile (module.js:413:34)
2016-06-16T03:45:17.000145+00:00 app[web.1]: at Function.Module._load (module.js:314:12)
2016-06-16T03:45:17.000146+00:00 app[web.1]: at Function.Module.runMain (module.js:447:10)
2016-06-16T03:45:17.000145+00:00 app[web.1]: at Module.load (module.js:357:32)
2016-06-16T03:45:18.010833+00:00 heroku[web.1]: Process exited with status 1
2016-06-16T03:45:18.019746+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-16T03:45:18.020059+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-16T03:45:20.364946+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-06-16T03:45:22.317904+00:00 app[web.1]: Error: Cannot find module 'webpack'
2016-06-16T03:45:22.317905+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:339:15)
2016-06-16T03:45:22.317899+00:00 app[web.1]:
2016-06-16T03:45:22.317877+00:00 app[web.1]: module.js:341
2016-06-16T03:45:22.317905+00:00 app[web.1]: at Function.Module._load (module.js:290:25)
2016-06-16T03:45:22.317892+00:00 app[web.1]: throw err;
2016-06-16T03:45:22.317909+00:00 app[web.1]: at Module.load (module.js:357:32)
2016-06-16T03:45:22.317906+00:00 app[web.1]: at Module.require (module.js:367:17)
2016-06-16T03:45:22.317910+00:00 app[web.1]: at Function.Module._load (module.js:314:12)
2016-06-16T03:45:22.317907+00:00 app[web.1]: at require (internal/module.js:20:19)
2016-06-16T03:45:22.317908+00:00 app[web.1]: at Module._compile (module.js:413:34)
2016-06-16T03:45:22.317907+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:77)
2016-06-16T03:45:22.317908+00:00 app[web.1]: at Object.Module._extensions..js (module.js:422:10)
2016-06-16T03:45:22.317898+00:00 app[web.1]: ^
2016-06-16T03:45:22.317910+00:00 app[web.1]: at Function.Module.runMain (module.js:447:10)
2016-06-16T03:45:23.310093+00:00 heroku[web.1]: Process exited with status 1
2016-06-16T03:45:23.327129+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-16T03:45:30.105406+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nyps.herokuapp.com request_id=096eccfb-7363-4137-88ef-c15389e7a664 fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:45:32.009229+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nyps.herokuapp.com request_id=50951c24-4f9a-4347-963c-70c48560ab90 fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:55:36.073640+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-16T03:55:36.073633+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-16T03:55:35.881416+00:00 heroku[api]: Deploy 85518b7 by nitesh@campusdiaries.com
2016-06-16T03:55:35.881515+00:00 heroku[api]: Release v4 created by nitesh@campusdiaries.com
2016-06-16T03:55:36.170187+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-16T03:55:51.915142+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-06-16T03:55:57.123301+00:00 app[web.1]: ==> Listening on port 3000. Open up http://localhost:3000/ in your browser.
2016-06-16T03:55:56.884371+00:00 app[web.1]: process production
2016-06-16T03:56:46.013013+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2016-06-16T03:56:46.012815+00:00 heroku[web.1]: Process running mem=556M(108.8%)
2016-06-16T03:56:51.994793+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-16T03:56:51.994793+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-16T03:56:53.386252+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-16T03:56:53.364620+00:00 heroku[web.1]: Process exited with status 137
2016-06-16T03:56:53.383770+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-16T03:57:01.236167+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=nyps.herokuapp.com request_id=3058277f-f351-4ff9-8cb7-e8500217bf1b fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:57:01.627497+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-06-16T03:57:03.490555+00:00 app[web.1]: ==> Listening on port 3000. Open up http://localhost:3000/ in your browser.
2016-06-16T03:57:03.405989+00:00 app[web.1]: process production
2016-06-16T03:57:23.431249+00:00 app[web.1]: webpack built 114bd08e06394dc17ec8 in 19974ms
2016-06-16T03:58:01.964579+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=nyps.herokuapp.com request_id=ba97ba30-cc4b-493f-8907-4341a650b361 fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:58:02.073841+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-16T03:58:02.073797+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-16T03:58:02.741937+00:00 heroku[web.1]: Process exited with status 137
2016-06-16T03:58:02.770625+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-16T03:58:04.232803+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nyps.herokuapp.com request_id=db9f5b88-805d-4917-9eb4-2d4827572afc fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:58:06.684479+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nyps.herokuapp.com request_id=6b3b9797-f3d9-48e5-aebd-c157a2603596 fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:58:42.837687+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nyps.herokuapp.com request_id=6a3ca1a5-ed23-416a-b3cf-3e755ee9e88e fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T03:58:46.216435+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nyps.herokuapp.com request_id=52e5d646-ef1d-418e-8196-ddc79d68001b fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T04:04:10.169663+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nyps.herokuapp.com request_id=b27e2500-1b84-4d8c-90d1-412a95ca3b13 fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
2016-06-16T04:04:11.771412+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nyps.herokuapp.com request_id=e7e7c74e-656c-4b85-abde-48cc54e3367c fwd="106.51.20.194" dyno= connect= service= status=503 bytes=
我在使用var webpack = require('webpack')
server.js
的第一行调用node server.js
我删除了node_module; rm -rf node_module
npm install
了。仍面临同样的问题。
答案 0 :(得分:7)
这更像是一个麻烦的答案,但这个问题通常会出现两个问题之一:
npm install webpack -g
)如果您运行的服务器需要webpack
,则您需要将其安装为dependency
。
如果您没有使用任何服务器端中间件,那么将webpack
设置为devDependency通常就是您想要的。
答案 1 :(得分:1)
我对使用create-react-app
创建的应用程序存在相同的问题,并且解决了该问题,我去了Heroku中的应用页面的Settings
标签,然后进入了Builpacks
我添加的部分是:https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz
作为构建包。