简体   繁体   English

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

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

I'm a beginner programmer and I'm trying to run the Rails Server through my command line.我是一名初学者程序员,我正在尝试通过我的命令行运行 Rails 服务器。 I type in "rails server" in my command line, and receive this error:我在命令行中输入“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.

After receiving this error, I run 'bundle install'.收到此错误后,我运行“捆绑安装”。 Once I run 'bundle install', I type in "rails server" in my command line and receive the same error:运行“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.

Here's a copy of my GemFile:这是我的 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

Can someone help me get my rails server up and running?有人可以帮我让我的 Rails 服务器启动并运行吗? Thanks!谢谢!

try deleting the "1.2.5" in your gemfile so the line looks like:尝试删除 gemfile 中的“1.2.5”,使该行如下所示:

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

then run然后运行

bundle install

again再次

I think I once got this error a long time ago - it had something to do with having sqlite.dll in my bin or lib folder in my computer's ruby dir or something like that.我想我很久以前曾经遇到过这个错误 - 它与在我的 bin 或 lib 文件夹中的 sqlite.dll 或我计算机的 ruby 目录或类似的东西有关。 I think Michael Hartl's tutorial mentions something about it.我认为 Michael Hartl 的教程提到了一些关于它的内容。

Have you tried just你试过吗

gem 'sqlite3'

You might also want to confirm that your gem is properly installed in your environment:您可能还想确认您的 gem 是否已正确安装在您的环境中:

gem list

You can also get more information about a specific gem:您还可以获得有关特定 gem 的更多信息:

gem specification sqlite3-ruby

I am assuming that you have no issues with installing other gems - that is, you don't need to set up a http_proxy environment variable for bundle install .我假设您在安装其他 gem 时没有问题 - 也就是说,您不需要为bundle install设置 http_proxy 环境变量。

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

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