problem with bundle

前端 未结 6 1572
醉梦人生
醉梦人生 2021-01-02 11:50

I try command bundle install --local but it show issue:

-bash: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or dir         


        
相关标签:
6条回答
  • 2021-01-02 12:11

    For newly created gem-set gem bundler is missing for me,

    Before bundler install path for it, /usr/local/bin/bundler

    Installed bundler to resolve issue.

    gem install bundler --no-ri --no-rdoc
    

    Bundler path changes to, /home/root/.rvm/gems/ruby-2.2.1@drag-drop-list/bin/bundler

    0 讨论(0)
  • 2021-01-02 12:23

    On my side, I am using rbenv.
    When I checked the /usr/local/bin/bundle, it shows it is using the older ruby, thus causing the problem.

    #!/usr/bin/ruby1.9.1
    

    by changing it to point to proper ruby fix the problem

    #!/home/user/.rbenv/shims/ruby
    
    0 讨论(0)
  • 2021-01-02 12:23

    Encountering this same problem, I found bundler installation in /var/lib/gems/2.3.0/gems/bundler-1.16.1;
    Then i fixed the error by creating a symbolic link like this:

    ln -s /var/lib/gems/2.3.0/gems/bundler-1.16.1/ /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1

    I did this because I needed this version of ruby.

    0 讨论(0)
  • 2021-01-02 12:28

    The solution that worked for me was entirely different, perhaps because I've been inconsistent about using RVM or not.

    I used 'which bundler' to find out where bundler was being launched, it was from /usr/bin/bundler. Noticing that /usr/bin/bundler began with a location and version of ruby that did not exist on my system any more, I did

    gem uninstall bundler
    gem install bundler
    

    Checking 'which bundler' again confirmed that bundler was now installed within a .rvm environment instead of /usr/bin/bundler, and now references the correct version of ruby; so bundle install now works for my rails project.

    0 讨论(0)
  • 2021-01-02 12:30

    I think you need to export the path of ruby and bundle in your .bashrc (linux).

    Open your .bashrc and add this line:

    export PATH="$PATH:/usr/bin:/usr/local/bin/"
    

    It should work.

    0 讨论(0)
  • 2021-01-02 12:34

    The bundle executable is provided by the bundler gem. If you are using rvm then seeing which bundle in /usr/local/bin/bundle indicates a problem, because use of rvm means gems like bundler are installed under your home directory, usually in ~/.rvm/gems/....

    # Symptoms of a broken bundler installation:-
    
    # Cannot start Rails...
    $ bin/rails s
    /Users/rogermarlow/project/config/boot.rb:9:in 'rescue in <top (required)>': uninitialized constant Bundler (NameError)
    
    # bundle not working...
    $ bundle install
    zsh: /usr/local/bin/bundle: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory
    #    ^----- that path does not look right, rvm does not put gems there
    $ which bundle
    /usr/local/bin/bundle
    # ^--- I want bundle from something under ~/.rvm/gems
    
    # First check rvm is in effect:
    $ rvm reload
    RVM reloaded!
    $ which ruby
    /Users/rogermarlow/.rvm/rubies/ruby-2.3.4/bin/ruby
    # ^--looks good, it is an rvm path, not /usr/local/bin/...
    
    # Now fix bundler
    $ gem uninstall bundler    # just in case
    $ gem install bundler
    Fetching: bundler-1.16.1.gem (100%)
    Successfully installed bundler-1.16.1
    1 gem installed
    $ which bundle
    /Users/rogermarlow/.rvm/gems/ruby-2.3.4@project/bin/bundle
    $ ^--- that is better, bundle is on a path controlled by rvm
    
    # bundle now working
    $ bundle install
    Fetching gem metadata from http://rubygems.org/..........
    *snip*
    
    # rails now working
    $ bin/rails s
    => Booting Thin
    => Rails 4.2.7.1 application starting in development on http://localhost:3000
    *snip*
    
    0 讨论(0)
提交回复
热议问题