为什么我不能安装JSON gem?

时间:2022-08-24 21:47:21
  1. I am getting Bundle Updated when I run bundle update
  2. 当我运行Bundle update时,我将获得Bundle更新
  3. Json 1.8.6 is installed.
  4. Json 1.8.6安装。
  5. But when I run jekyll build, I get this error:

    但是当我运行jekyll构建时,我得到了这个错误:

    WARN: Unresolved specs during Gem::Specification.reset: listen (< 3.1, ~> 3.0) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:40:in block in setup': You have already activated json 2.0.2, but your Gemfile requires json 1.8.6. Prependingbundle exec` to your command may solve this. (Gem::LoadError)

    警告:在Gem:::规范中未解决的规格。重置:聆听(< 3.1,~> 3.0)警告:清除未解决的规格。如果引起问题,请报告错误。/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.5 / lib /打包机/运行时。rb:40:在安装块中':您已经激活了json 2.0.2,但是您的Gemfile需要json 1.8.6。在你的命令前面加上“执行包”可能会解决这个问题。(Gem::LoadError)

1 个解决方案

#1


4  

Seems like you have multiple versions of json installed and the wrong version is being used

似乎您已经安装了多个版本的json,并且使用了错误的版本

Prepending bundle exec to your command may solve this.

在命令前挂起bundle exec可以解决这个问题。

As the warning suggest you can add bundle exec before your command. This will make sure to use the Gem versions mentioned in your Gemfile.

如警告所示,您可以在命令之前添加bundle exec。这将确保使用Gemfile中提到的Gem版本。

bundle exec jekyll build

and

bundle exec jekyll serve

#1


4  

Seems like you have multiple versions of json installed and the wrong version is being used

似乎您已经安装了多个版本的json,并且使用了错误的版本

Prepending bundle exec to your command may solve this.

在命令前挂起bundle exec可以解决这个问题。

As the warning suggest you can add bundle exec before your command. This will make sure to use the Gem versions mentioned in your Gemfile.

如警告所示,您可以在命令之前添加bundle exec。这将确保使用Gemfile中提到的Gem版本。

bundle exec jekyll build

and

bundle exec jekyll serve