webpacker: Cannot read property 'compile' of undefined when running ./bin/webpack-dev-server
ruby 2.3.4 rails 5.1.4 node 8.9.4
I get next error when trying to run ./bin/webpack-dev-server
/home/project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:405
throw e;
^
TypeError: Cannot read property 'compile' of undefined
at addCompilerHooks (/home/project/node_modules/webpack-dev-server/lib/Server.js:71:16)
at new Server (/home/project/node_modules/webpack-dev-server/lib/Server.js:81:5)
at startDevServer (/home/project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:398:14)
at processOptions (/home/project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:361:5)
at Object.<anonymous> /home/project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:504:1)
at Module._compile (module.js:662:30)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
Does anyone faced with the same error?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 29 (5 by maintainers)
Commits related to this issue
- FIX: TEMPORARY downgrade webpack-dev-server to 2.11.1 https://github.com/rails/webpacker/issues/1303 — committed to dschmura/rails5template by dschmura 6 years ago
- Downgrade webpack dev server yarn upgrade webpack-dev-server@^2.11.1 https://github.com/rails/webpacker/issues/1303#issuecomment-369090507 — committed to Sinetheta/payment_request_api by Sinetheta 6 years ago
- handle webpacker related versioning issues https://github.com/rails/webpacker/issues/1303 — committed to LaunchAcademy/make_it_so by dpickett 6 years ago
- Add a home page and fix webpack version https://github.com/rails/webpacker/issues/1303#issuecomment-369090507 — committed to GPif/test_wttj by GPif 6 years ago
- Downgrade webpack to 2.11 Ref: https://github.com/rails/webpacker/issues/1303 — committed to yeo/notyim by deleted user 6 years ago
- :arrow_down: Downgrade "webpack-dev-server" to 2.11.2 Belongs to #332 Ref: rails/webpacker#1303 — committed to ledermann/docker-rails by ledermann 6 years ago
- Downgrade WDS because of https://github.com/rails/webpacker/issues/1303 — committed to anicholson/dotnich2018 by anicholson 6 years ago
- Downgrade to 2.11 as webpacker-dev-server not running in higer version https://github.com/rails/webpacker/issues/1303 — committed to redpanthers/starter by coderhs 5 years ago
I was having the same issue with: Ruby: 2.4.1 Rails: 5.1.2 Node: 8.9.4
I was following the Readme instructions to upgrade(
yarn upgrade webpack-dev-server --latest
), however this installed webpack-dev-server v3.1.0. When I downgraded to v2.11.1 (yarn upgrade webpack-dev-server@^2.11.1
) my dev server worked again!I can confirm. Sticking with 2.11.1 works for the interim.
Reverting back to version 2.9.1 still shows the security hole:
The problem with downgrading is that there’s a CVE for webpack-dev-server < 3.11.1 - https://nvd.nist.gov/vuln/detail/CVE-2018-14732
Operating System: Windows Node Version: 8.9.4 NPM Version: 6.5.0 webpack Version: 3.6.0 webpack-dev-server Version: 2.9.0
i’m having the same problem of
cannot destructure property compile of 'undefined' or 'null'
and my solution is at https://github.com/webpack/webpack-dev-server/issues/1259 @smackggwith this command:
npm install --save-dev webpack-dev-server@2.9.7
Thanks everyone. We will update Webpacker to use webpack 4.0 soon - in meantime please use the supported dev server version.
I experienced the same. Thank you for this solution.
Yep downgrading to 2.11.1 works. Rails 5.1.5
I confirm that @Terit solution works!
It seems like there should be some version ranges specified going to ease confusion. I’d be more than happy to help with implementation.
My proposal is to
Happy to help out, and I know that there is a shift to webpack 4 where this won’t be an issue soon, but that’s not to say there won’t be the same issue in the future.
I met the same issue, and downgrading webpack-dev-server to 2.11.1 fixed it. Thanks!
I’m seeing the same thing with:
Ruby: 2.5.0 Rails: 5.2.0.rc1 Node: v8.9.4