Webpacker: Cannot find module 'webpack'

Created on 1 Apr 2017  Â·  9Comments  Â·  Source: rails/webpacker

I try to understand with webpack and such error after such launch starts ./bin/webpack-dev-server
In another terminal. PLS help me.

`module.js:327
throw err;
^

Error: Cannot find module 'webpack'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/andrew/railsapp/wpacktest/node_modules/webpack-dev-server/lib/Server.js:15:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
`

Most helpful comment

Would be nice if we could programmatically check these prerequisites and give the right error message on what to do.

On Apr 1, 2017, at 14:20, Bryan Lim notifications@github.com wrote:

Check the prerequisites of webpacker 1.1 https://github.com/rails/webpacker#prerequisites

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

All 9 comments

Have you run ./bin/rails webpacker:install?

@gauravtiwari yep

@gauravtiwari, I got this error. Can not find application.js in /home/andrew/railsapp/wpacktest/public/packs/manifest.json. Is webpack still compiling? And after I looked in Troubleshooting and executed the command ./bin/webpack-dev-server

You get that error because webpack isn't installed. Could you run this ./bin/rails webpacker:install again please and follow the options?

Btw, what version of webpacker you using? It's 1.1

Got same error. Decided this way:

  • Update nodejs to 6.x (I had 5.x).
  • Run ./bin/rails webpacker:install and ./bin/yarn install.
  • Run bin/webpack-dev-server.
  • If there will be errors about missing webpack or babel-loader - add them to package.json:
{
  "devDependencies": {
    "webpack-dev-server": "^2.4.2"
  },
  "dependencies": {
    // another dependencies
    "babel-core": "^6.24.0",
    "babel-loader": "^6.4.1",
    "webpack": "^2.3.2",
  }
}
  • Run ./bin/yarn install and bin/webpack-dev-server again.

Check the prerequisites of webpacker 1.1 https://github.com/rails/webpacker#prerequisites

Would be nice if we could programmatically check these prerequisites and give the right error message on what to do.

On Apr 1, 2017, at 14:20, Bryan Lim notifications@github.com wrote:

Check the prerequisites of webpacker 1.1 https://github.com/rails/webpacker#prerequisites

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@gambala, thx bro.
@gauravtiwari , sorr, i had node js ~4.v and after I upgraded to 6 all earned.

Was this page helpful?
0 / 5 - 0 ratings