From 5c8805034f5f59b7278f895fca7b6fd7dfda7af5 Mon Sep 17 00:00:00 2001 From: Joshua LeBlanc Date: Wed, 24 Feb 2021 18:28:11 -0400 Subject: [PATCH] execute yarn executable using current ruby interpreter This change is required to support windows. It explicitly runs the bin/yarn file using the ruby executable that's running the rake task. --- railties/lib/rails/tasks/yarn.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/tasks/yarn.rake b/railties/lib/rails/tasks/yarn.rake index 5da0b4081b..8fb86fb32e 100644 --- a/railties/lib/rails/tasks/yarn.rake +++ b/railties/lib/rails/tasks/yarn.rake @@ -10,13 +10,13 @@ namespace :yarn do end yarn_flags = - if `"#{Rails.root}/bin/yarn" --version`.start_with?("1") + if `#{RbConfig.ruby} "#{Rails.root}/bin/yarn" --version`.start_with?("1") "--no-progress --frozen-lockfile" else "--immutable" end - system({ "NODE_ENV" => node_env }, "\"#{Rails.root}/bin/yarn\" install #{yarn_flags}") + system({ "NODE_ENV" => node_env }, "#{RbConfig.ruby} \"#{Rails.root}/bin/yarn\" install #{yarn_flags}") rescue Errno::ENOENT $stderr.puts "bin/yarn was not found." $stderr.puts "Please run `bundle exec rails app:update:bin` to create it."