[英]Rails 3 - no such file to load -- openssl
運行 Rails 服務器時,出現以下錯誤:沒有要加載的此類文件 -- openssl
我嘗試了我在網上找到的解決方案。 我去~/.rvm/src/ruby-1.9.2-head/ext/openssl。 我輸入:ruby extconf.rb,但我得到以下信息:
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.
我不能使用 make 或 make install。
rvm pkg install openssl
(舊格式 - rvm package install openssl
)
rvm pkg install iconv
(舊格式 - rvm package install iconv
)
rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr
檢查此說明http://rvm.io/packages/openssl/ - 請記住,快速修復只是一個塊而不是整個頁面。
您必須為 openssl/net/http 安裝庫,運行以下代碼,然后安裝 openssl 和 iconv.. 以下代碼將適用於 UBUNTU..
sudo apt-get install libopenssl-ruby1.9.1
這是 ruby 1.9.1。
sudo apt-get install libopenssl-ruby
for ruby 1.8.x
首先檢查你的 rvm 是否有 openssl 包。 轉到 /usr/local/src/rvm/ruby-1.9.2-p290/
然后轉到 ext/openssl。
輸入ruby extconf.rb如果我們發現這樣的錯誤
enter code here
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above
然后安裝 apt-get install libssl-dev.Once installed rub ruby extconf.rb 。現在將安裝 openssl
對於 ubuntu,我做了以下事情:
apt-get install libssl-dev
cd ruby-1.9(source directory used to install ruby)/ext/openssl
ruby extconf.rb
make
make install
這為我解決了問題:
rvm pkg install openssl
rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr
並且不要忘記將 ruby 版本更改為您正在使用的版本。 如果您有舊的 rvm,您可能也應該首先更新它。
我做了
rvm pkg install openssl
rvm reinstall 1.9.3
並做了!
您可能想嘗試運行 ruby-1.9.2-rc2 而不是 head? 不確定它是否會解決這個問題,但我確實在嘗試運行時遇到了很多問題
很確定命令看起來像 - rvm install 1.9.2-rc2
您將需要再次重新安裝導軌
這個錯誤意味着你的 Ruby 不是用 openssl 編譯的。 假設您使用 RVM,以下是解決此問題的步驟。
1.安裝openssl包
rvm pkg install openssl
2.刪除你正在使用的Ruby安裝
rvm remove 1.9.3
3.最后用openssl重新編譯Ruby
rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
4.現在一切都應該正常了。 不要忘記:
rvm 使用 1.9.3 --default
請嘗試以下步驟。
如果您已經有 ruby 版本,請使用
rvm 重新安裝 ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.