【问题标题】:Why am I not able to install JSON gem?为什么我无法安装 JSON gem?
【发布时间】:2017-07-13 13:06:30
【问题描述】:
  1. 当我运行 bundle update 时,我正在更新 Bundle
  2. Json 1.8.6 已安装。
  3. 但是当我运行 jekyll build 时,我得到了这个错误:

    警告:Gem::Specification.reset 期间未解决的规范: 听 ( 3.0) 警告:清除未解决的规范。 如果这会导致问题,请报告错误。 /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` 到你的命令可以解决这个问题。 (Gem::LoadError)

【问题讨论】:

  • 如警告所示,您可以在命令前添加 bundle exec

标签: ruby-on-rails json ruby rubygems jekyll


【解决方案1】:

您好像安装了多个版本的json 并且使用了错误的版本

在您的命令前添加 bundle exec 可能会解决此问题。

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

bundle exec jekyll build

bundle exec jekyll serve

【讨论】:

  • 那么,从现在开始,我不能使用捆绑服务了吗?总是使用执行?不过,它有效。谢谢。
  • bundle exec 只是确保使用正确版本的 gem
  • @maximusdooku: alias j='bundle exec jekyll' - 让你“j serve”。容易多了!
猜你喜欢
  • 2011-07-10
  • 1970-01-01
  • 2014-02-01
  • 2010-09-30
  • 2018-12-12
  • 1970-01-01
  • 2011-07-20
  • 1970-01-01
  • 2016-08-17
相关资源
最近更新 更多