LoginSignup
5
1

More than 5 years have passed since last update.

bundle installで「Downloading xxx revealed dependencies not in the API or the lockfile」というエラーが出た時の対処法

Last updated at Posted at 2018-03-09

bundle installで特定のgemがインストールできない

Railsの勉強中、書籍に付属のサンプルプログラムを動かすため、ソースをダウンロードしてbundle installを実行したら以下のようなエラーが出た。

bundle install
Fetching gem metadata from https://rubygems.org/..........
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2

...

Fetching rdoc 4.2.0
Downloading rdoc-4.2.0 revealed dependencies not in the API or the lockfile (json (~> 1.4)).
Either installing with `--full-index` or running `bundle update rdoc` should fix the problem.

In Gemfile:
  sdoc was resolved to 0.4.1, which depends on
    rdoc

どうやらrdoc-4.2.0というgemのダウンロードでコケている模様。
この状態でbin/rails sを実行すると、対象のgemが見つからない旨のエラーが出る。

Could not find rdoc-4.2.0 in any of the sources
Run `bundle install` to install missing gems.

かなしい。

対処法

エラーメッセージによると--full-indexbundle update rdocを実行しろとのこと。

Either installing with `--full-index` or running `bundle update rdoc` should fix the problem.

--full-indexbundle installのオプションのようだが、説明を見てもよくわからなかった…

Use the rubygems modern index instead of the API endpoint.
Bundler: bundle install

Gemfile.lockを見てみると対象gemのバージョンが別環境と異なっていたので、問題となっているgemをアップデートすることにした。

bundle update rdoc

bundle update rdocを実行するとGemfile.lockで指定されているrdocのバージョンが更新された。

Using rdoc 4.3.0 (was 4.2.0)

以降のgemも無事にインストールされ、bin/rails sでプログラムの起動が確認できた。

補足

Gemfile.lockで指定されているgemのバージョンが、RubyGems.orgのリストに存在しない場合にも「Could not find xxx in any of the sources」エラーが発生する模様。

bundle install すると Could not find xxx in any of the sources と怒られる場合の対処法 - Qiita

こちらもgemのupdateで解決するみたい。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1