webpacker: Command "webpack-dev-server" not found.
I’m trying to create a new project with webpacker
in rails and I constantly get the error
yarn run v0.24.6
error Command "webpack-dev-server" not found.
When trying to launch the dev server.
Run down of the commands:
rails new testapp--webpack
./bin/rails webpacker:install:vue
./bin/webpack-dev-server
yarn run v0.24.6
error Command "webpack-dev-server" not found.
System configuration
- Rails:
5.1.1
- Ruby:
2.4.1p111
- Node:
v6.10.2
- Yarn:
v0.24.6
- OS: Ubuntu 16.10
I’m also running this on a Vagrant machine with the version 1.9.3
I tried doing:
$ sudo npm install -g webpack-dev-server
$ npm install (from the rails project folder)
$ yarn
$ ./bin/yarn install
Nothing seems to work. Any help?
Thanks!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 17
- Comments: 52 (23 by maintainers)
Commits related to this issue
- webpack or webpack-dev-server not found (#516) * webpack or webpack-dev-server not found Add to troubleshooting of readme to prevent such issues https://github.com/rails/webpacker/issues/379#issue... — committed to rails/webpacker by ytbryan 7 years ago
- webpack or webpack-dev-server not found (#516) * webpack or webpack-dev-server not found Add to troubleshooting of readme to prevent such issues https://github.com/rails/webpacker/issues/379#issue... — committed to sensiblegame/webpack by sensiblegame 7 years ago
- Resolve Broken Webpacker Issue Install webpacker in dependencies instead of devDependencies per https://github.com/rails/webpacker/issues/506#issuecomment-455878837 — committed to MAPC/trailmap3 by mzagaja 5 years ago
- webpack or webpack-dev-server not found (#516) * webpack or webpack-dev-server not found Add to troubleshooting of readme to prevent such issues https://github.com/rails/webpacker/issues/379#issue... — committed to KingTiger001/Rails-web-pack-project by KingTiger001 7 years ago
- webpack or webpack-dev-server not found (#516) * webpack or webpack-dev-server not found Add to troubleshooting of readme to prevent such issues https://github.com/rails/webpacker/issues/379#issue... — committed to smartech7/ruby-webpacker by ytbryan 7 years ago
Thanks @ytbryan. @luispcosta as suggested could you please re-run
bundle exec rails webpacker:install
and see if./bin/webpack-dev-server
works for you?I was missing a
package.json
file, which wasn’t getting initialized when I ranrails webpacker:install
.Running
yarn init
, thenrails webpacker:install
added these dependencies:and then
bin/webpack-dev-server
worked.I had this same problem (randomly - on a project that had been working fine for months) - I think it had something to do with npm messing up my node_modules.
Running
bundle exec rails webpacker:install
and clickingn
to every suggestion worked fine for me.for me command
yarn
did the trick.@hovancik Could you please remove
node_modules
folder and doyarn install
?@luispcosta you should do
rails:webpacker:install
Because
rails new testapp--webpack
there is a missing spaceTherefore, rails:webpacker:install not called. Therefore you don’t have a config/webpack.
That worked fine to me, Thanks. What’s the login here? I’m using rails 5.2.2 and I thought
rails:webpacker:install
was supposed to do all the job.@luispcosta Is webpacker installed i.e.
config/webpack
exists and allnode_modules
are bundled? Check node_modules folder please.@frenangomes Yes if you have run
bundle exec rails webpacker:install
it should add that automatically for you. Perhaps the command exited prematurely due to an underlying error with node or yarn version. Could you check that please, trying running this command again -bundle exec rails webpacker:install
?