New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No such file or directory - /usr/src/app/bin/yarn #40795
Comments
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.
Looks like Try to run |
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
If you run |
Running
This is in a fresh Rails 6.1 application created with |
We are still using sprockets to compile javascripts and we are getting the same error. It is was caused by this change #40722 (b087511) full stack trace:
It worked fine in 6.1.0.rc2, it was broken by final release. |
running
|
Allright, thanks for trying it out. It looks like the problem in the end lies in those lines then: rails/railties/lib/rails/tasks/yarn.rake Lines 23 to 26 in b087511
It always runs the task on precompiling assets, even though it seems it shouldn't because you skipped javascript. That is why it removes Before b087511, the task would fail silently. It still was a bug that it was run at all but it did no harm. Now it breaks the pipeline. I already have PR #40785 ready and will change it so that if the task fails it will at least continue with everything else like before. Edit: I just changed it so it only runs To fix it properly something must be done with the lines I quoted above – maybe they should even be removed completely so |
Based on discussion in rails#40795, it looks like `yarn:install` is *always* run, even if the Rails project disabled javascript and there is no `bin/yarn`. Check for the existence of `bin/yarn` to decide if `yarn:install` should be run or not. The check for this is taken from `railties/lib/rails/app_updater.rb`, where it does the same: ```ruby options[:skip_javascript] = !File.exist?(Rails.root.join("bin", "yarn")) ```
@doits Looks like it fixes it for us 👍, thanks, hopefully it gets merged soon. |
@doits I can confirm that this fixes things for my case as well. Thanks! |
What temporary solution is suitable? I really need version 6.1, but because of this problem, I can't update. |
@mukinabis see barsoom/pipeline@3906724 where the rake task is overwritten to do nothing |
@rafaelfranca Do you have a minute to explain the rationale behind closing this issue? As far as I understand, |
@KevinBongart fix was merged #40785, no need for open issue anymore. |
Any idea what is happening here.. this is a project I have upgraded to Rails 6.1, but when I run
The project is using webpacker. |
Ah, ignore my question.. It is a duplicate of: #40868 |
Hey! Has this fix been pushed to the main branch yet? Just installed rails 6.1.0 and still having the same issue. |
@AnthonyFrancis no new version is released but it is included in 6-1-stable |
As a temporary fix, you can add the following to your Rakefile: Rake::Task["yarn:install"].clear
namespace :yarn do
task :install do
# Do nothing, since there's no yarn
end
end |
@AnthonyFrancis looks like Rails 6.1.1 was just released and it includes the fix for |
Steps to reproduce
When I run
bin/rails assets:precompile
I get aErrno::ENOENT
exception. Probably related to #40739.Expected behavior
I expect the precompilation of assets to fallback to existing yarn when not found in
bin
directory.Actual behavior
System configuration
Rails version: 6.1.0
Ruby version: 2.7.2
The text was updated successfully, but these errors were encountered: