ruby bundle install require: no such files to load

2019-02-06 06:19发布

问题:

I am running into troubles installing gems through bundle install from an app that i cloned through git.

Here is the what the output from bundle install looks like:

bundle install
/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8:in `require': no such file to load --     rubygems (LoadError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8
from /usr/lib/ruby/vendor_ruby/bundler.rb:11:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:11
from /usr/bin/bundle:4:in `require'
from /usr/bin/bundle:4

I read up on google and other stackoverflow questions but the file pointed to above is in th ruby folder so it should not be anyway related to the app (which in theory would mean i wouldn't be able to bundle install for any app). any way how to fix this??

any help will be deeply appreciated!

回答1:

I have the same question with yours, I searched a lot, but no one is the solution, at last, I asked co-worker in my company, he just ran

gem list

to list the local gems, we found there's no bundler gem, so he ran

gem install bundler

then he ran

bundle install

OK, it worked.



回答2:

Are you in the directory where your gemfile is located? I believe your current directory needs to be there.



回答3:

Once Gemfile.lock is created, whenever you run bundle install, Bundler reads this file rather than Gemfile to work out the dependencies of the application and installs from it.

try check Gemfile/Gemfile.lock what is need to install



回答4:

Make sure you're inside your application's directory before you bundle install. Because it will find the GemFile and check what gem needs to install



回答5:

Run the following command :

sudo apt-get install rubygems build-essential

It should work like a charm.



回答6:

I had this same problem (exact same output) and it is solved for me by simply installing the package 'rails'.