Skip to content

Commit

Permalink
Add an error message in case bin/yarn is missing
Browse files Browse the repository at this point in the history
One reason why it could be missing because Rails was upgraded but `rails
app:update` was not run.

Running `rails app:update:bin` should create it.

refs rails#40795
  • Loading branch information
doits committed Dec 11, 2020
1 parent f4265ae commit 0180128
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions railties/lib/rails/tasks/yarn.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ namespace :yarn do
end

system({ "NODE_ENV" => node_env }, "\"#{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."
exit 1
end
end

Expand Down

0 comments on commit 0180128

Please sign in to comment.