webpacker: webpacker is installed... ./bin/webpack: not found

Iā€™m not sure how to interpret this error that I get when trying to precompile assets on the server.

  1. webpacker is installed
  2. but webpack is not found
  3. A JSON text must at least contain two octets! (thanks but which JSON file?)
app@vagrant:/var/www/app/application$ bundle exec rake assets:precompile
Webpacker is installed šŸŽ‰ šŸ°
Using /var/www/app/application/config/webpack/paths.yml file for setting up webpack paths
Compiling webpacker assets šŸŽ‰
sh: 1: ./bin/webpack: not found
rake aborted!
JSON::ParserError: A JSON text must at least contain two octets!
/home/app/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/home/app/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Doh. ā€˜~> 2.0ā€™. I guess I assumed webpacker:install:react would bootstrap it all. Sorry for wasting your time.

@raldred Did you run rails webpacker:install ? Which version of webpacker are you using?

I also experienced this issue while trying to add webpacker to an existing rails app. The solution I used was to run the webpacker:installscript first Then after that was done, I ran webpacker:install:react which added the files I needed.

Trying to run webpacker:install:react first caused the error that brought me here in the first place šŸ˜„

Running rails 4.2. I also had to rake webpacker:install before rake webpacker:install:vue

@raldred , same problem, I am assumed webpacker:install:react would auto generate all config files

i ran bundle exec bin/rails app:update:bin and so now i have a bin folder. i still get the same error though (there is no webpack binstub in the folder).

ok, so the problem seems to be that the auto-generated .gitignore file from rails 4.x has the bin folder in the .gitignore file. iā€™m going to play around with not .gitignoring the bin folder and see if that resolves the issue

the issue was caused by the bin folder not being present, and updating the .gitignore file and redeploying fixed it.