diff --git a/vite_ruby/lib/tasks/vite.rake b/vite_ruby/lib/tasks/vite.rake index bfa8ed18..2394ad37 100644 --- a/vite_ruby/lib/tasks/vite.rake +++ b/vite_ruby/lib/tasks/vite.rake @@ -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