简体   繁体   中英

Rails assets:precompile is using wrong bundler version

I recently updated my dockerized rails app (5.0 -> 5.2) and am now using Bundler 2.

I've added RUN gem install bundler to my Dockerfile to ensure I have Bundler 2 installed. My RUN bundle install step runs fine, but when I get to the asset precompile step it seems to start using Bundler 1 again:

Step 12/17 : RUN rails assets:precompile --trace
 ---> Running in facccf7d562c
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)

1. Why is the asset precompile even using bundler?

2. How can I force it to user Bundler 2?

Here is the snippet of my Dockerfile that fails (on the last step):

RUN gem install bundler

RUN bundle install
RUN yarn install
RUN rails assets:precompile --trace

You may need to force Bundler to manage the dependencies:

bundle exec rails assets:precompile

Where that ensures the Gem environment is locked in as per the Gemfile .

Rails generally tries to get this working for you, but there are occasions when it can't quite get things in sync and the behaviour you're seeing manifests.

似乎是Ruby 2.4.0升级到2.4.5的错误,解决了此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM