Skip to content

Commit

Permalink
Catch npm command not found, for folks who install deps with yarn (#217)
Browse files Browse the repository at this point in the history
Co-authored-by: Máximo Mussini <maximomussini@gmail.com>
  • Loading branch information
woodhull and ElMassimo authored Jun 2, 2022
1 parent 4f1a32f commit 7a0407b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vite_ruby/lib/tasks/vite.rake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ namespace :vite do

desc 'Ensure build dependencies like Vite are installed before bundling'
task :install_dependencies do
cmd = `npm --version`.to_i < 7 ? 'npx ci --yes' : 'npx --yes ci'
legacy_flag = `npm --version`.to_i < 7 rescue false
cmd = legacy_flag ? 'npx ci --yes' : 'npx --yes ci'
system({ 'NODE_ENV' => 'development' }, cmd)
end

Expand Down

0 comments on commit 7a0407b

Please sign in to comment.