LoginSignup
0
0

More than 3 years have passed since last update.

An error occurred while installing json (2.3.0), and Bundler cannot continue

Posted at

初めに

これが本当に正しい修正方法かは疑問ですが、
少し戸惑ってしまったり悩んでしまったのでここに記述します。

対応としては、使用Rubyのバージョン変更です。
色々言われた通りコマンド打ってもうまくいかなかったので、、、

エラー

$ bundle installとして出るエラー

Gem files will remain installed in /Users/***/sample/vendor/bundle/ruby/2.6.0/gems/json-2.3.0 for inspection.
Results logged to /Users/***/sample/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/json-2.3.0/gem_make.out

An error occurred while installing json (2.3.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.3.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  cocoapods was resolved to 1.9.3, which depends on
    cocoapods-core was resolved to 1.9.3, which depends on
      algoliasearch was resolved to 1.27.3, which depends on
        json

対応

言われたコマンドを色々打って見てもダメだったので使用するRubyのバージョンを変更しようと思いました!
結果通りました!

以下参考にさせていただきました!
犬でもわかるRuby on Rails 環境構築 for MacOS

ですが、パスを通してもダメでした、、
結論通すパスが間違っていました。
変わったのでしょうか?
私の場合は以下を通すべきでした。

$ echo 'export PATH="$HOME/.rbenv/versions/2.7.1/bin:$PATH"' >> ~/.bash_profile

なのでbash_profileに記述されるはずのものは以下。
export PATH="$HOME/.rbenv/versions/2.7.1/bin:$PATH"

$ source ~/.bash_profile
の反映処理も忘れずに。

$ open $HOME/.rbenvで開いたらbinフォルダがないことで発覚。

っというかPATH指定しないと変えられないってこれからその都度パス指定しなおさないといけないの???

と言ってもこれRubyのバージョンあるところ指定しているだけのような気も、、、

ちなみに、

~/.bash_profileに

eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/shims:$PATH"

って書かないと

$ rbenv local 2.7.1
$ rbenv versions

の切り替えはうまく行きませんでした、、、

ただこれ、

$ rbenv global 2.6.0
しても
$ ruby -v
グローバル変わらない、、、

$ which rubyの出力もOKそう。あ、最終的にこれではあれなのでここも変わりますが以下操作で、、、
/Users/***/.rbenv/shims/ruby

以下みたいに直接指定なら変わる、、、

~/.bash_profileに

export PATH="$HOME/.rbenv/versions/2.7.1/bin:$PATH"

$ rbenv global 2.6.0
的なので変わらないのなんでだろう、、、
直に指定しないと、新しい → 古い 出来ないのでしょうか?

また何か分かったら追記します🙇‍♀️

0
0
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
0
0