开发者

problem with bundle

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

-b开发者_开发百科ash: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory. 

please help me.


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.


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.


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*


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


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜