Just started out with a brand new rails 5.1.4 project on Windows, using --webpack=react. During the rails new task, the rails webpacker:install:react threw out an error.
webpack binstubs not found.
Have you run rails webpacker:install ?
Make sure the bin directory or binstubs are not included in .gitignore
Exiting!
The binstubs webpack and webpack-dev-server are both in the bin directory and marked as executable. I'm not sure why it thinks the binstubs are missing.The binstub works just fine if I run it myself.
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ webpack
Hash: 2f0ced181a75c1462b79
Version: webpack 3.10.0
Time: 714ms
Asset Size Chunks Chunk Names
application-8f8bdd9f4ff51391ec46.js 3.26 kB 0 [emitted] application
application-8f8bdd9f4ff51391ec46.js.map 3.19 kB 0 [emitted] application
manifest.json 142 bytes [emitted]
[0] ./app/javascript/packs/application.js 515 bytes {0} [built]
Here's all the information/steps I tried to take for reference. I've also tried bundle binstubs webpacker --force as the log suggests below.
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ bundle exec rails -v
Rails 5.1.4
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ bundle exec webpack -v
3.10.0
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ bundle exec rails webpacker:install
yarn check v1.3.2
success Folder in sync.
Done in 0.14s.
identical config/webpacker.yml
Copying webpack core config
exist config/webpack
identical config/webpack/development.js
identical config/webpack/environment.js
identical config/webpack/production.js
identical config/webpack/test.js
Copying .postcssrc.yml to app root directory
identical .postcssrc.yml
Copying .babelrc to app root directory
identical .babelrc
Creating JavaScript app source directory
exist app/javascript
identical app/javascript/packs/application.js
Installing binstubs
run bundle binstubs webpacker from "."
Skipped webpack and webpack-dev-server since they already exist.
If you want to overwrite skipped stubs, use --force.
Adding configurations
append .gitignore
Installing all JavaScript dependencies
run yarn add @rails/webpacker [email protected] from "."
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] Building fresh packages...
success Saved 1 new dependency.
鈹斺攢 @rails/[email protected]
Done in 5.44s.
Installing dev server for live reloading
run yarn add --dev webpack-dev-server from "."
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
[4/4] Building fresh packages...
success Saved 1 new dependency.
鈹斺攢 [email protected]
Done in 5.54s.
Webpacker successfully installed 馃帀 馃嵃
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ bundle exec rails webpacker:install:react
webpack binstubs not found.
Have you run rails webpacker:install ?
Make sure the bin directory or binstubs are not included in .gitignore
Exiting!
eearslya@MINGW64 ~/RubymineProjects/test-project (master)
$ ls bin
bundle* rails* rake* setup* update* webpack* webpack-dev-server* yarn*
Try @gauravtiwari's answer?
https://github.com/rails/webpacker/issues/1122#issuecomment-352570441
I found the issue. 202d0a5b3132bddb292306e57b1ae785f5697f29 is the commit that fixed this, but it hasn't been rolled into a release as of yet.
Temporary solution is to run the gem off of the git repo.
gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
Here's hoping it gets a bugfix release soon!
Will make a new release this weekend 馃憤
Most helpful comment
I found the issue. 202d0a5b3132bddb292306e57b1ae785f5697f29 is the commit that fixed this, but it hasn't been rolled into a release as of yet.
Temporary solution is to run the gem off of the git repo.
gem 'webpacker', git: 'https://github.com/rails/webpacker.git'Here's hoping it gets a bugfix release soon!