1

rails -v ruby​​ -v gem -v

都得到正确的答案。但是当我运行 rails new blog 时,我收到以下错误消息:

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- openssl (LoadError)

以下是完整的跟踪:

run  bundle install
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- openssl (LoadError)
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/lib/ruby/1.9.1/net/https.rb:92:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/net/http/persistent.rb:447:in `ssl'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/net/http/persistent.rb:216:in `connection_for'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/net/http/persistent.rb:358:in `request'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/fetcher.rb:135:in `fetch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/fetcher.rb:163:in `fetch_dependency_remote_specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/fetcher.rb:122:in `fetch_remote_specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/fetcher.rb:70:in `specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/source.rb:234:in `block in remote_specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/source.rb:232:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/source.rb:232:in `remote_specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/source.rb:165:in `fetch_specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/source.rb:70:in `specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:205:in `block (2 levels) in index'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:202:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:202:in `block in index'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/index.rb:9:in `build'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:198:in `index'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:192:in `resolve'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:122:in `resolve_remotely!'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/installer.rb:48:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/installer.rb:12:in `install'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/cli.rb:220:in `install'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/thor.rb:263:in `dispatch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/vendor/thor/base.rb:386:in `start'
        from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/bin/bundle:13:in 
4

2 回答 2

1

你可以尝试安装 libopenssl-ruby 包。

sudo apt-get install libopenssl-ruby

在此之后您必须重新安装 ruby​​。

于 2012-04-11T12:52:37.873 回答
0

尝试sudo apt-get install openssl libssl-dev- libssl-dev 添加开发头文件。

于 2012-04-11T13:23:08.437 回答