Skip to content

Commit

Permalink
Fix yarn issue during deploy
Browse files Browse the repository at this point in the history
When running `rake assets:precompile`, `railties-6.1.0/lib/rails/tasks/yarn.rake` gets called
and since we don't have yarn installed it will cause an exception.

There is an issue on this: rails/rails#40795.

When fixed, this temporary fix should be removed.
  • Loading branch information
Peter Wall and Tomas Skogberg committed Dec 11, 2020
1 parent 64c5a08 commit 3906724
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/tasks/fix_yarn_issue.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# FIXME: Remove this file when https://github.com/rails/rails/issues/40795 has a fix.

Rake::Task[ "yarn:install" ].clear
namespace :yarn do
desc "Disabling internal yarn install from Rails"
task install: :environment do
puts "Disabling internal yarn install from Rails"
end
end

Rake::Task[ "webpacker:yarn_install" ].clear
namespace :webpacker do
desc "Disabling internal yarn install from Rails"
task yarn_install: :environment do
puts "Disabling internal yarn install from Rails"
end
end

2 comments on commit 3906724

@olleolleolle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was like 🤔 “Hm, we could put a file bin/yarn in the repo with a tiny echo "Remove this file when https://github.com/rails/rails/issues/40795 has a fix”

But that’s more for laughs than for serious!

@tskogberg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super idea!

Please sign in to comment.