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

时间:2011-08-13 02:51:03

标签: ruby-on-rails sqlite

我是初学程序员,我正在尝试通过命令行运行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'。一旦我运行'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服务器吗?谢谢!

4 个答案:

答案 0 :(得分:1)

尝试删除gemfile中的“1.2.5”,使其显示为:

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

然后运行

bundle install

再次

答案 1 :(得分:0)

我想我很久以前就遇到过这个错误 - 它与我的计算机的ruby目录中的bin或lib文件夹中的sqlite.dll有关。我认为迈克尔哈特尔的教程提到了一些事情。

答案 2 :(得分:0)

你试过吗

gem 'sqlite3'

答案 3 :(得分:0)

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

gem list

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

gem specification sqlite3-ruby

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