【问题标题】:Ruby on Rails : Rake db:create -> Could not find gemRuby on Rails:Rake db:create -> 找不到 gem
【发布时间】:2011-12-04 15:56:12
【问题描述】:

我从 ruby​​ on rails 开始,我正在尝试创建我的第一个博客。于是我跑了:

rails new blog -database=mysql

出现错误:

Gem::InstallError: The 'json' native gem requires installed build tools.

但是因为我在我的博客目录中看到了一个 json 目录,所以我不在乎。 所以我运行命令来创建数据库:

rake db:create --trace 

我还有另一个错误:

Could not find gem 'rails (= 3.1.3) x86-mingw32' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

有人知道是什么问题吗?

【问题讨论】:

    标签: ruby-on-rails ruby rubygems gem rake


    【解决方案1】:

    也可能需要运行

    bundle exec rake db:create
    

    【讨论】:

    • 它不起作用在您的 Gemfile 中列出的任何 gem 源中找不到 gem 'rails (= 3.1.3) x86-mingw32'。运行 bundle install 以安装缺少的 gem。
    【解决方案2】:

    您可以尝试“gem list | grep json”来检查 json 是否已经安装。 然后,您可以在 Gemfile 中添加以下行(在您网站的目录中):

    gem 'json'

    然后

    bundle install jsonbundle update json

    祝你好运,

    【讨论】:

    • 它找到了 json,但我仍然有同样的错误在 Gemfile 中列出的任何 gem 源中找不到 gem 'rails (= 3.1.3) x86-mingw32'。运行 bundle install 以安装缺少的 gem。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-22
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多