即使在捆绑安装后,rails也找不到宝石

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了即使在捆绑安装后,rails也找不到宝石相关的知识,希望对你有一定的参考价值。

我正在尝试在做bundle install后启动我的rails服务器。但是,当我尝试做rails s时,会弹出此错误

Could not find gem 'byebug (= 9.0.6)' in any of the gem sources listed in your Gemfile. Run bundle install to install missing gems.

然后我运行bundle install但弹出同样的错误。我也尝试在gemfile中摆脱byebug,但它只是给了我同样的错误,但有一个不同的宝石。我尝试使用gem install byebug -v 9.0.6单独安装byebug,但同样的问题仍然存在。

这是我的宝石文件

source 'https://rubygems.org'

gem 'rails',        '5.1.6'
gem 'puma',         '3.9.1'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.7.0'

group :development, :test do
  gem 'sqlite3', '1.3.12'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',  '9.0.6', platform: :mri 
end

group :development do
  gem 'web-console',           '3.5.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
答案

您应该使用bundle exec rails s运行rails服务器以使其位于捆绑包的上下文中。

以上是关于即使在捆绑安装后,rails也找不到宝石的主要内容,如果未能解决你的问题,请参考以下文章