Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 安装RVM,Ruby on Mac OS X Sierra:无法要求openssl_Ruby On Rails_Macos_Openssl_Rvm_Homebrew - Fatal编程技术网

Ruby on rails 安装RVM,Ruby on Mac OS X Sierra:无法要求openssl

Ruby on rails 安装RVM,Ruby on Mac OS X Sierra:无法要求openssl,ruby-on-rails,macos,openssl,rvm,homebrew,Ruby On Rails,Macos,Openssl,Rvm,Homebrew,我遇到了在新Mac笔记本电脑上安装RVM+Rubies的问题,在安装RVM和自制软件后,Rails的安装遇到了错误: ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources ERROR: While executing gem ... (Gem::Except

我遇到了在新Mac笔记本电脑上安装RVM+Rubies的问题,在安装RVM和自制软件后,Rails的安装遇到了错误:

ERROR:  While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
背景和环境

  • MacOSX10.12.3。(塞拉利昂)
  • 自制1.1.8。安装了OpenSSL之后
  • RVM 1.28.0
  • Ruby 2.3.3 Rails(正在尝试安装最新版本)
  • 环境变量(以下)在Shell环境中设置了以下变量
  • LDFLAGS=-L/usr/local/opt/openssl@1.1/解放党
  • CPPFLAGS=-I/usr/local/opt/openssl@1.1/包括
  • PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig
发现和故障诊断

从一台干净的笔记本电脑开始,我按照通常的方式安装了自制软件、Xcode命令行工具、MySQL(用于rails开发)、Git,然后是RVM。即使设置了环境变量,还卸载和重建了RVM,删除并重新添加了Homebrew中的OpenSSL,但在尝试安装Rails时,我还是会遇到以下错误:

ERROR:  While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
另一项需要注意的是,在安装RVM时,我确保RVM了解自制软件:

rvm autolibs enable
ram autolibs homebrew
ruby-2.3.3安装的输出如下:

Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.3.tar.bz2
Checking requirements for osx_brew.
Updating Homebrew...
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.3.3 - #configure
ruby-2.3.3 - #download
ruby-2.3.3 - #validate archive
ruby-2.3.3 - #extract
ruby-2.3.3 - #validate binary
Libraries missing for ruby-2.3.3: /Users/travis/.rvm/rubies/ruby-2.3.3/lib/libruby.2.3.0.dylib. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/grantsayer/.rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
ruby-2.3.3 - #extracting ruby-2.3.3 to /Users/grantsayer/.rvm/src/ruby-2.3.3
下一步


目前我陷入困境-无法通过此步骤或通过查看其他帖子来验证,以获得有效的解决方案。

我找到了前面描述的问题的解决方案。以下步骤概述了如何解决此问题

清理

  • 通过
    ruby-e“$(curl-fsSL)删除了自制软件的安装https://raw.githubusercontent.com/Homebrew/install/master/uninstall)“

  • 通过
    RVM内爆

  • 重建

  • 使用
    ruby-e“$(curl-fsSL)安装自制软件
    https://raw.githubusercontent.com/Homebrew/install/master/install)“

  • 使用
    Brew升级
    Brew医生

  • 使用
    \curl-sSL安装RVM(再次!)https://get.rvm.io |bash-s稳定
  • 使用
    RVM autolibs homebrew
  • 设置环境变量,以便我们知道openssl的安装位置:

    导出LDFLAGS=-L/usr/local/opt/openssl/lib

    导出CPPFLAGS=-I/usr/local/opt/openssl/include

    导出PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

  • 通过rvm安装2.3.3--autolibs=homebrew安装ruby

  • 检查它是否工作

  • 使用
    rvm osx ssl certs status all
    检查rvm空间是否知道OpenSSL证书。运行此命令会产生以下输出:
    Certificates for/usr/local/etc/openssl/cert.pem:update.

  • 通过
    gem安装rails安装rails


  • 在最后一步中,安装成功,Rails正在工作(最后!)

    如果其他阅读器不工作的话- 试试这个:

    rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
    rvm install 2.4.0
    

    如果这对您有效,并告诉开发人员您非常感谢他的努力:)

    您能展示一下安装ruby-2.3.3和rails所使用的命令吗?只是一种预感,但我不建议通过rvm安装rails。更可靠的方法是通过rvm安装ruby,然后通过
    gem安装rails--no ri--no rdoc安装rails
    尝试检查rvm正在使用的证书的状态:
    rvm osx ssl certs status all
    。这将输出每个证书的状态。如果它不是最新的,您可以使用
    rvm osx ssl certs update all
    更新它们。同意使用gem安装rails-这是我通常做的-在描述中可能不清楚。检查证书rvm正在使用并且运行该命令没有输出。非常感谢,这实际上是唯一对我有效的解决方案,…并尝试了来自各地的一些。很高兴这有帮助。还有一项——我发现我不需要导出环境变量。我想,重置所有内容并重新安装后,所有内容都得到了整理。是的,也不必导出env vars。我在自行编译的Ruby安装中遇到了类似的问题。在用自制软件安装OpenSSL之后,重新编译Ruby对我来说是可行的。谢谢我遇到了另一个问题:
    rvm
    版本是最新的稳定版本(v1.29.3),而这个版本的rvm是强制的openssl@1.1由自制安装,由于。这个问题自2017年9月起就出现了,但还没有新的稳定版本。另外,我在这个答案的
    export
    s中添加的另一个步骤是
    export RUBY\u CONFIGURE\u OPTS=--with openssl dir=“$(brew--prefix openssl)”
    ,但我不知道是否需要这样做。