5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

webpacker:install:reactでWebpack binstubs not foundエラーが出たときの緊急対処方法

Posted at

概要

  • webpacker:install:react or webpacker:install:reactWebpack binstubs not found.で失敗したときの暫定対処方法
  • エラーの原因はwebpackwebpack-dev-serverインストールされていないこと
  • 応急措置として、該当ファイルをwebpackerのソースからダウンロードして、適切な場所にコピーして、再度実行したら解決できた

環境

  • Docker: Version 17.09.0-ce-mac35 (19611)
  • ruby: 2.4.2 (2.4.1でも同様の状況を確認)
  • rails: 5.1.4
  • node: 8, (6, 7, 9でも同様の状況を確認)
  • webpacker: 3.0.2
  • mac: 10.13.1

詳細

事前内容

エラーログ抜粋

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.

省略

Done in 44.63s.
Webpacker successfully installed 🎉 🍰
       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!
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

原因

ログを見ると原因は、webpackwebpack-dev-serverbin/にコピーされていないことだとわかった。

対処法

  • ファイルが足りないのが原因なので、webpackerのマスターからwebpackwebpack-dev-serverをダウンロードしてbin/にコピーし、再度webpacker:install:reactを実行したら解決した。

  • なお、ログで勧められているbundle binstubs webpacker --forceをしてもうまくいきませんでした。

その他

  • 数ヶ月前は特に問題なかったので、webpackerのバージョンの原因かも
  • docker以外でエラーが発生するかどうかは試していない。
5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?