Ruby on rails 创建新Rails 3项目时出错:`require';:无法加载这样的文件--openssl(LoadError)

Ruby on rails 创建新Rails 3项目时出错:`require';:无法加载这样的文件--openssl(LoadError),ruby-on-rails,ruby,ruby-on-rails-3.1,installation,Ruby On Rails,Ruby,Ruby On Rails 3.1,Installation,当我尝试创建一个新项目($railsnewfirst_app)时,在创建目录结构后会出现以下错误 ... ... create vendor/plugins/.gitkeep run bundle install /home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such fil

当我尝试创建一个新项目($railsnewfirst_app)时,在创建目录结构后会出现以下错误

...
...
      create  vendor/plugins/.gitkeep
         run  bundle install
/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- openssl (LoadError)
    from /home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/https.rb:22:in `<top (required)>'
...
...
。。。
...
创建供应商/插件/.gitkeep
运行包安装
/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site\u ruby/1.9.1/rubygems/custom\u require.rb:36:在'require'中:无法加载此类文件--openssl(LoadError)
from/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site\u ruby/1.9.1/rubygems/custom\u require.rb:36:in'require'
from/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/https.rb:22:in`'
...
...
以下是Ubuntu 10.04的配置

$ rails -v
Rails 3.2.1
$ rvm -v

rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]

$ bundle -v
Bundler version 1.0.21
$ gem -v
1.8.15
$rails-v
轨道3.2.1
$rvm-v
rvm 1.10.2由Wayne E.Seguin,Michal Papis编写[https://rvm.beginrescueend.com/]
$bundle-v
捆绑包版本1.0.21
$gem-v
1.8.15

请帮助我解决此问题。

您需要将ruby与openssl支持捆绑在一起。看看

rvm重新安装1.9.3——使用openssl dir=/usr/local


这要求您的设备上有openssl头。它们在不同的系统中有不同的名称,如
libopenssl-dev
libssl-dev
openssl-devel
等。

在Ubuntu Lucid(10.04)上也有同样的问题。固定为:

sudo apt-get install libssl-dev
rvm remove 1.9.3
rvm install 1.9.3
这个解决方案对我很有效

假设RVM正在使用

rvm pkg install openssl
去除红宝石

rvm remove 1.9.3
最后用openssl重新编译Ruby

rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
最后

rvm use 1.9.3 --default
我希望这对以后的搜索有用。

如果您不使用RVM,以下是如何:

sudo-apt-get-install-libssl-dev
./configure--prefix=/usr/local
制作
安装

以下是Mac OS 10.8的说明(尽管这些说明似乎很一般)


可能会有帮助。可能重复:。我尝试了建议的链接,但仍然收到相同的错误。我重新安装了ruby和rails,但运气不好。我错过了安装openssl的rvm包的一个步骤。我再次遵循所有步骤,错误消失了。谢谢您确定--with openssl dir=[path]是openssl所在的正确路径吗?你安装了openssl和openssl头文件/devel包了吗?我明白了。通过使用您的建议和Alex Kliuchnikau共享的链接,openssl错误终于消失了。感谢64位系统操作:sudo apt get install libssl dev&rvm replay 1.9.3——使用openssl dir=/usr/lib/x86_64-linux-gnu/linux Mint 12。sudo apt get install openssl&&rvm reinstall 1.9.3——使用openssl dir=/usr/localIf如果您在Ubuntu上,并且“rvm reinstall”命令无法识别,您可能需要遵循以下步骤:我确认这也适用于Ubuntu 12.10。我使用的重新安装变体如下:
sudoapt-get-install-libssl-dev&&rvm-reinstall 1.9.3
rvm pkg install openssl
rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr