Running “bundle install” fails and asks me to run “bundle install”

孤街醉人 提交于 2019-12-09 09:49:54

问题


In fact, all gem-related commands result in the same error message, when run from inside the existing rails app I cloned from a git repo.

$ bundle install
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.

$ gem list
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.

$ bundle update
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.

$ rails -v
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.

I thought I already had rails installed... (following commands were run from outside the app directory):

$ rails -v
Rails 3.0.3

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]

Any idea what's up with "bundle install" telling me to run "bundle install"??


I exited my app directory and manually did

sudo gem install tzinfo -v 0.3.27

But upon entering my app directory again and trying "bundle install"...

$ bundle install
Could not find polyglot-0.3.1 in any of the sources
Run `bundle install` to install missing gems.

So I went back out of the app directory, did

sudo gem install polyglot -v 0.3.1

"bundle install" now yielded

$ bundle install
Could not find treetop-1.4.9 in any of the sources
Run `bundle install` to install missing gems.

Why am I having to manually install all these random gems that I didn't have to in the past? (new dev env). Anyone know what I could have set up wrong in my environment?


回答1:


OK guess I fixed it..

For the gems that running bundle install complained about when run from inside the app directory, I installed them by going outside the app directory and doing sudo gem install [gem] one by one. Doing bundle install --gemfile=myApp/Gemfile also installed a couple of the missing gems.

I have no idea why I wasn't able to just run bundle install from inside the app directory...lame.




回答2:


I had this problem. Once I did:

[root@smaug ~]# PATH=$PATH:~/.gem/ruby/2.0.0/bin

[root@smaug ~]# export PATH

Then it was fixed and I could just

[root@smaug msf3]# bundle install

successfully.




回答3:


The problem is that all your commands have actually prepended bundle exec. If you take a look at the output it is bundler telling you your gems are not installed. This can happen if you have some plugin in rbenv installed like rbenv-bundle-exec, rbenv-bundler or rbenv-binstubs. At least for me, it was happening the first time you try to bundle install in a project, because it actually detects there is a Gemfilein the current folder and tries to do bundle exec bundle install which obviously won't work.

You can use the solution of Tim, and run bundle install from outside the project folder.

You can disable or uninstall temporally the extension that is prepending bundle exec to ruby commands.

Or if the problem is happening because you use rbenv-bundle-exec, just do:

NO_BUNDLE_EXEC=1 bundle install




回答4:


Installing ruby from rubyinstaller

and then gem install bundle fixed the issue for me on a win 10 PC.




回答5:


I had a very similar issue, after trying many different things I finally found a simple solution that worked...I restarted my computer (mac os 10.9x). No joke.



来源:https://stackoverflow.com/questions/6971290/running-bundle-install-fails-and-asks-me-to-run-bundle-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!