Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingExecutableError when deploying with Capistrano #192

Closed
octave opened this issue Feb 22, 2022 · 4 comments
Closed

MissingExecutableError when deploying with Capistrano #192

octave opened this issue Feb 22, 2022 · 4 comments

Comments

@octave
Copy link

octave commented Feb 22, 2022

Hi,

I get this error at rake assets:precompile when deploying with Capistrano. It looks like it's not doing a yarn install first?

$HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 Building with Vite ⚡️
      01 rake aborted!
      01 ViteRuby::MissingExecutableError: ❌ The vite binary is not available. Have you installed the npm packages?
      01
      01 Visit the Troubleshooting guide for more information:
      01   https://vite-ruby.netlify.app/guide/troubleshooting.html#troubleshooting
      01
      01 No such file or directory - /$HOME/node_modules/.bin/vite
@octave octave added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Feb 22, 2022
@ElMassimo ElMassimo added bug: needs reproduction and removed bug: pending triage Something doesn't seem to be working, but hasn't been verified labels Feb 23, 2022
@ElMassimo
Copy link
Owner

ElMassimo commented Feb 23, 2022

Hi Octave! Thanks for reporting 😃

Vite Ruby will install dependencies if assets:precompile was not defined, otherwise it assumes that webpacker or sprockets would, and skips it to avoid running install twice.

This assumption has changed given all the recent activity in the Rails ecosystem (jsbundling-rails, propshaft, etc).

Please share a minimal reproduction with the gems in the application that define the assets:precompile task before Vite Ruby does in a way that does not install dependencies.

That way we can gather more information about specific gems that might need to be taken into account in order to extend assets:precompile as needed.

@octave
Copy link
Author

octave commented Feb 23, 2022

Hi @ElMassimo!

No worries! I generated my rails app with the --minimal parameter. And so my Gemfile currently look like this:

ruby "3.1.0"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.2", ">= 7.0.2.2"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

gem 'turbo-rails'

gem 'vite_rails'

If you add --css=bootstrap when generating your app it adds the gem cssbundling-rails which trig yarn install when running assets:precompile

The workaround I found for now, is to use the gem capistrano-yarn and in the capistrano production.rb I configure it like this: set :yarn_flags, '--development'.

@ElMassimo
Copy link
Owner

ElMassimo commented Feb 23, 2022

I think it might be reasonable to extend assets:precompile with vite:install_dependencies if webpacker, cssbundling-rails, and jsbundling-rails are not in the loaded gems.

For now, as a workaround, you can do:

Rake::Task['vite:verify_install'].enhance(['vite:install_dependencies'])

@ElMassimo
Copy link
Owner

Released a fix in vite_ruby@3..0.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants