From cb0f810cd002237a8689022332299a8c42779f33 Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Fri, 2 Apr 2021 15:04:38 -0400 Subject: [PATCH] Exit before assets:precompile task if yarn:install fails This `raise` was recommended by @y-yagi in https://github.com/rails/rails/pull/36852 --- railties/lib/rails/tasks/yarn.rake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/railties/lib/rails/tasks/yarn.rake b/railties/lib/rails/tasks/yarn.rake index 8fb86fb32e..0226da721a 100644 --- a/railties/lib/rails/tasks/yarn.rake +++ b/railties/lib/rails/tasks/yarn.rake @@ -16,7 +16,11 @@ namespace :yarn do "--immutable" end - system({ "NODE_ENV" => node_env }, "#{RbConfig.ruby} \"#{Rails.root}/bin/yarn\" install #{yarn_flags}") + system( + { "NODE_ENV" => node_env }, + "#{RbConfig.ruby} \"#{Rails.root}/bin/yarn\" install #{yarn_flags}", + exception: true + ) rescue Errno::ENOENT $stderr.puts "bin/yarn was not found." $stderr.puts "Please run `bundle exec rails app:update:bin` to create it."