安装了两个版本的捆绑器并使用了错误的一个
Two versions of bundler installed and using the wrong one
我安装了正确版本的 Bundler:
docker@f5990915a8ae:/usr/src/app$ bundler version
Bundler version 2.2.17 (2021-05-05 commit 69cbd6e10e)
但是当我 运行 时 db:migrate 似乎正在使用另一个:
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.17). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.17.
这是我的应用程序 gem 环境:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /home/docker/.gem
- USER INSTALLATION DIRECTORY: /home/docker/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/bin/ruby2.7
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/docker/.gem/bin
- SPEC CACHE DIRECTORY: /home/docker/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/docker/.gem
- /home/docker/.gem/ruby/2.7.0
- /var/lib/gems/2.7.0
- /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/docker/.gem//bin
- /home/docker/.gem/ruby/2.7.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
这是安装的两个捆绑器版本:
home/docker/.gem/specifications/bundler-2.2.17.gemspec
usr/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.4.gemspec
如何让db:migrate使用正确的?
改为
bundle exec rake db:migrate
或在 Gemfile.lock
中更改捆绑程序版本
我安装了正确版本的 Bundler:
docker@f5990915a8ae:/usr/src/app$ bundler version
Bundler version 2.2.17 (2021-05-05 commit 69cbd6e10e)
但是当我 运行 时 db:migrate 似乎正在使用另一个:
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.17). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.17.
这是我的应用程序 gem 环境:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /home/docker/.gem
- USER INSTALLATION DIRECTORY: /home/docker/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/bin/ruby2.7
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/docker/.gem/bin
- SPEC CACHE DIRECTORY: /home/docker/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/docker/.gem
- /home/docker/.gem/ruby/2.7.0
- /var/lib/gems/2.7.0
- /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/docker/.gem//bin
- /home/docker/.gem/ruby/2.7.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
这是安装的两个捆绑器版本:
home/docker/.gem/specifications/bundler-2.2.17.gemspec
usr/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.4.gemspec
如何让db:migrate使用正确的?
改为
bundle exec rake db:migrate
或在 Gemfile.lock
中更改捆绑程序版本