繁体   English   中英

为什么我的 Rails 服务器不能在 OS X Lion 上运行?

[英]Why won't my Rails server run on OS X Lion?

我是一名初学者程序员,我正在尝试通过我的命令行运行 Rails 服务器。 我在命令行中输入“rails server”,然后收到此错误:

    Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
    Run `bundle install` to install missing gems.

收到此错误后,我运行“捆绑安装”。 运行“bundle install”后,我在命令行中输入“rails server”并收到相同的错误:

    Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
    Run `bundle install` to install missing gems.

这是我的 GemFile 的副本:

    source 'http://rubygems.org'

    gem 'rails', '3.0.9'

    # Bundle edge Rails instead:
    # gem 'rails', :git => 'git://github.com/rails/rails.git'

    gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

    # Use unicorn as the web server
    # gem 'unicorn'

    # Deploy with Capistrano
    # gem 'capistrano'

    # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
    # gem 'ruby-debug'
    # gem 'ruby-debug19', :require => 'ruby-debug'

    # Bundle the extra gems:
    # gem 'bj'
    # gem 'nokogiri'
    # gem 'sqlite3'
    # gem 'aws-s3', :require => 'aws/s3'

    # Bundle gems for the local environment. Make sure to
    # put test-only gems in this group so their generators
    # and rake tasks are available in development mode:
    # group :development, :test do
    #   gem 'webrat'
    # end

有人可以帮我让我的 Rails 服务器启动并运行吗? 谢谢!

尝试删除 gemfile 中的“1.2.5”,使该行如下所示:

gem 'sqlite3-ruby', :require => 'sqlite3'

然后运行

bundle install

再次

我想我很久以前曾经遇到过这个错误 - 它与在我的 bin 或 lib 文件夹中的 sqlite.dll 或我计算机的 ruby 目录或类似的东西有关。 我认为 Michael Hartl 的教程提到了一些关于它的内容。

你试过吗

gem 'sqlite3'

您可能还想确认您的 gem 是否已正确安装在您的环境中:

gem list

您还可以获得有关特定 gem 的更多信息:

gem specification sqlite3-ruby

我假设您在安装其他 gem 时没有问题 - 也就是说,您不需要为bundle install设置 http_proxy 环境变量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM