简体   繁体   English

无法使用ruby版本ruby-1.8.7-p374进行捆绑安装和gem install bundler -v 1.17.3

[英]Unable to do bundle install and gem install bundler -v 1.17.3 with ruby version ruby-1.8.7-p374

OS in use: Mac OS High Sierra Version: 10.13.6 使用的操作系统:Mac OS High Sierra版本:10.13.6

I have an RVM installed with the following Ruby versions: 我安装了具有以下Ruby版本的RVM:


MAC-070618-A:website anujaw$ rvm list
   ruby-1.8.7-head [ i686 ]
   ruby-1.8.7-p358 [ i686 ]
=> ruby-1.8.7-p374 [ i686 ]
 * ruby-2.3.7 [ x86_64 ]
   ruby-2.4.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Ruby version I need for running an app locally on my machine is: ruby-1.8.7-p374 I am trying to do a bundle install and getting below error: 我需要在机器上本地运行应用程序的Ruby版本是:ruby-1.8.7-p374我正在尝试进行bundle install并出现以下错误:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
    from /usr/local/bin/bundle:22:in `<main>'

When I do gem install bundler as below, I get an error: 当我如下所示执行gem install bundler ,出现错误:


MAC-070618-A:website anujaw$ gem install bundler -v 1.17.3
ERROR:  Loading command: install (LoadError)
    no such file to load -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

I already have OpenSSL installed, see below: 我已经安装了OpenSSL,请参见下文:

    MAC-070618-A:website anujaw$ brew info openssl
    openssl: stable 1.0.2q (bottled) [keg-only]
    SSL/TLS cryptography library
    https://openssl.org/
    /usr/local/Cellar/openssl/1.0.2o_2 (1,792 files, 12.3MB)
      Poured from bottle on 2018-07-23 at 14:37:12
    /usr/local/Cellar/openssl/1.0.2q (1,794 files, 12.1MB)
      Poured from bottle on 2019-01-30 at 14:12:51
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
    ==> Caveats
    A CA file has been bootstrapped using certificates from the SystemRoots
    keychain. To add additional certificates (e.g. the certificates added in
    the System keychain), place .pem files in
      /usr/local/etc/openssl/certs

    and run
      /usr/local/opt/openssl/bin/c_rehash

    openssl is keg-only, which means it was not symlinked into /usr/local,
    because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

    If you need to have openssl first in your PATH run:
      echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

    For compilers to find openssl you may need to set:
      export LDFLAGS="-L/usr/local/opt/openssl/lib"
      export CPPFLAGS="-I/usr/local/opt/openssl/include"

    For pkg-config to find openssl you may need to set:
      export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

    ==> Analytics
    install: 465,985 (30 days), 1,553,385 (90 days), 6,076,848 (365 days)
    install_on_request: 59,235 (30 days), 217,436 (90 days), 854,397 (365 days)
    build_error: 0 (30 days)

Kindly advise how to get past this obstacle? 请告知如何克服这一障碍? Thanks. 谢谢。

So, I was able to resolve this error by referring to the following link: 因此,我能够通过参考以下链接解决此错误:

How to set correct Ruby version in gem environment 如何在gem环境中设置正确的Ruby版本

The main issue was that my Ruby gem (2.0.17) was not compatible with ruby 1.8.7 (2013-06-27 patchlevel 374) Following are the steps I did: Only after downloading RubyGems 1.6.2, unzipping it etc as the instructions say 主要问题是我的Ruby gem(2.0.17)与ruby 1.8.7(2013-06-27 patchlevel 374)不兼容,以下是我执行的步骤:仅在下载RubyGems 1.6.2,将其解压缩后作为指示说

So: 所以:

curl -O https://rubygems.org/rubygems/rubygems-1.6.2.tgz

then unzip the downloaded file; 然后解压缩下载的文件;

To extract a .tgz file with tar you need to use, 要使用tar提取.tgz文件,您需要使用,

tar -xvzf /path/to/yourfile.tgz
cd rubygems-1.6.2
rvm ruby-1.8.7-p374
ruby setup.rb
gem update --system 1.8.25

Then, run gem env to check your RubyGems environment. 然后,运行gem env检查您的RubyGems环境。 Hopefully, it will be ok and then run gem install bundler -v 1.17.3 希望可以,然后运行gem install bundler -v 1.17.3

我已经遇到了这个问题,我通过以下方法解决了:

gem update --system

Try running these command for your problem. 尝试运行这些命令解决您的问题。

sudo gem install -n /usr/local/bin bundler -v 1.17.3 sudo gem install -n / usr / local / bin捆绑器-v 1.17.3

Then, Install Ruby dependencies 然后,安装Ruby依赖项

bundle install 捆绑安装

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

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