Skip to content

Commit

Permalink
Exit before assets:precompile task if yarn:install fails
Browse files Browse the repository at this point in the history
This `raise` was recommended by @y-yagi in #36852
  • Loading branch information
jaredbeck committed Apr 13, 2021
1 parent 58ce690 commit cb0f810
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion railties/lib/rails/tasks/yarn.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit cb0f810

Please sign in to comment.