Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

ruby - Bundler failing to install

I am trying to update bundler in a project. i updated rbenv ruby 2.6.6. Then i ran bundle install and nothing happened. I followed the instructions in the error msg. Programme runs and then times out.

git:(master) ruby -v            
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin18]
 git:(master) bundler -v         
Traceback (most recent call last):
    2: from /Users/maryhealy/.rbenv/versions/2.6.6/bin/bundler:23:in `<main>'
    1: from /Users/maryhealy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/Users/maryhealy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /Users/maryhealy/code_old/yance/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
git:(master) gem install bundler
^CERROR:  Interrupted
 git:(master) gem install bundler:2.1.4
^CERROR:  Interrupted

I tried running this in project directory

gem install bundler -v '~> 2.1'       
ERROR:  Loading command: install (LoadError)
    dlopen(/Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle
  Reason: image not found - /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

I have old versions of ruby as per my gem env

?  ~ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.14.1
  - RUBY VERSION: 2.4.4 (2018-03-28 patchlevel 296) [x86_64-darwin17]
  - INSTALLATION DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
  - USER INSTALLATION DIRECTORY: /Users/maryhealy/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /Users/maryhealy/.rbenv/versions/2.4.4/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/bin
  - SPEC CACHE DIRECTORY: /Users/maryhealy/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-17
  - GEM PATHS:
     - /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
     - /Users/maryhealy/.gem/ruby/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/maryhealy/.rbenv/versions/2.4.4/bin
     - /usr/local/Cellar/rbenv/1.1.2/libexec
     - ./bin
     - ./node_modules/.bin
     - /Users/maryhealy/.rbenv/shims
     - /Users/maryhealy/.rbenv/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/maryhealy/.composer/vendor/bin
     - /usr/local/sbin

i have no idea how to fix the problem to update bundler. Any help appreciated?

question from:https://stackoverflow.com/questions/65884653/bundler-failing-to-install

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Installing bundler

You need to install Bundler globally, not only for the current project (in the project directory). This is because Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.

Open a terminal and write

gem install bundler

You can check if the installation is successful by writing

bundle -v

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...