When i try to do bundle install, my gem_path and gem_home point to /usr/local/rvm/gems/ which i don't have write access and it fails because of invalid permissions. because of this i've changed both paths to a local directory where i do have write access.
when doing so, i do a bundle install, i get :
bruno#test6:~$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Bundler::GemspecError: Could not read gem at /afs/varda.io/user/b/br/bruno/test6/cache/rake-10.1.0.gem. It may be corrupted.
An error occurred while installing rake (10.1.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.1.0'` succeeds before bundling.
well, if i do a gem install, it works just fine.
but bundle would just not work; even if a try to delete the cache folder that it complains about.
i did try "bundle install --no-cache" and it fails in the same way. (bundle install --deployment works fine too) how do i get bundle install to work ?
i've spent quite a bit of time, if anyone would have any guidance , i would really appreciate it!
Fixed it by deleting cache file and re-running bundle install.
rm -rf <location_of_cache>. In your case:
rm -rf /afs/varda.io/user/b/br/bruno/test6/cache
okay, first of all, you could solve all this issues easily by using rvm (user installation), see http://rvm.io, if that is not an option, you could try using project-specific gem paths.
for example i have the following bundler config file (~/.bundle/config)
---
BUNDLE_PATH: .bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"
which causes bundler to install all gems in a .bundle sub directory (inside your project folder, where you run bundle install). now, if you remember to use bundle exec for your bins (e.g. cap(istrano)), you're fine.
if you somehow f*cked up your bundler / cache, try deleting the .bundle folder (in your project folder)
rvm reinstall all worked for me.
Before you do that, I would try
gem update --system
gem pristine --all --no-extensions
please note that rvm reinstall all takes a lot of time to complete...
If it's feasible, I recommend installing your own copy of rvm in ~/.rvm so you aren't tied to the system one. Trying to have a hybrid system+user approach will likely lead to more headaches later on.
Or, if you're open to alternate solutions, rbenv is a leaner & cleaner ruby manager.
Try to tell to bundler which folder it must use, something like bundle install --path <myfolder> or bundle install --path gems.
Note that I didn't test this yet, but it seems promising, please post the result for us.
Related
While running the bundle install, it stops installing when it reaches the installation of the byebug gem. Saying, the gem maybe corrupt. I have tried uninstalling the ruby application and also tried updating my ruby and also my rails version
If you are using Bundler 1.1 or later you can use bundle clean, or bundle clean --force just as you imagined you could. This is redundant if you're using bundle install --path (Bundler manages the location you specified with --path, so takes responsibility for removing outdated gems), but if you've used Bundler to install the gems as system gems then bundle clean --force will delete any system gems not required by your Gemfile. Blindingly obvious caveat: don't do this if you have other apps that rely on system gems that aren't in your Gemfile!
Source -Bundle Clean
I have a very recurrent problem here. (it happens literally all the time). I have found ways to go around it but i really would appreciate a solution for this problem:
Here is how it goes:
At my development machine, i have in my gem file a line like this:
gem "sqlite3-ruby", :require => "sqlite3"
what happens is that, when i bundle install --no-deployment, it goes alright:
Using sqlite3 (1.3.5)
Using sqlite3-ruby (1.3.3)
Updating .gem files in vendor/cache
Your bundle is complete! It was installed into ./vendor/bundle
But then, in the deployment, running bundle install --deployment, i get:
Using sqlite3-ruby (1.3.3)
Updating .gem files in vendor/cache
Your bundle is complete! It was installed into ./vendor/bundle
... which causes require errors that makes the application crash.. Then, what i do is bundle install --no-deployment at the deployment machine. Then i run again bundle install --deployment and then, magically:
Using sqlite3 (1.3.5)
Using sqlite3-ruby (1.3.3)
Updating .gem files in vendor/cache
And then the application runs fine.
So, what i most basically want is that bundler recognizes the sqlite3 dependency on sqlite3 gem
But then, in the development, running bundle install --deployment, i get:
Okay, this is the first suspicious thing. Why would you run --deployment in development?
You generally don't want to do that. If you're switching all the time between "--deployment" and "--no-deployment" on the same machine, it's easy to get things confused, yes.
Running "bundle install --deployment" will save something in the .bundle/config file in your project, that tells bundler "from here on out, only install these certain gems". "--no-deployment" removes that again, in case you made a mistake or need to hack around. But in general, you shouldn't need to and don't want to always be switching back and forth. Run --deployment on your production/deployment machine, don't run it on your development machine. You don't ever need to run --no-deployment unless you made a mistake and didn't mean --deployment
At this point, I'd rm -rf .bundle (it's okay, it'll just remove all the things bundler 'remembers' about what you want to do, like --deployment), and start over with bundle install.
If there's some reason this doesn't work, then that's the question.
From the line Updating .gem files in vendor/cache, I suspect at some point you also ran bundle package, which is another thing that's "remembered" in the .bundle/config thing, and is also probably interacting with your other commands oddly and doing things you don't expect. Removing your .bundle/config will get rid of that remembered setting too. (you may also need to delete your ./vendor/cache directory contents)
Just run bundle install unless you have a reason you understand for needing package, and understand what it does. Or it'll confuse you.
I've run "bundle install" on an existing Rails 3 app which has the gems in vendor/cache (I guess they were packed via "bundle package" before) and valid Gemfile and Gemfile.lock files.
What I saw is, it created a folder .bundle in my home dir.
I am using also RVM. When I tried "gem list", I didn't see any of the gems in vendor/cache installed.
Am I doing something wrong? Everywhere the bundler articles say, execute "bundle" or "bundle install" to install the gems in the Gemfile and Gemfile.lock files. Is the problem connected with the RVM usage?
Thanks for any advice.
If you give an argument to bundle install, it will keep installing the gems inside this directory, even if you rm -rf that directory and start from scratch with the pure bundle install, as noted in Emil's comment. This new directory is taken by default by bundler, and it even supersedes what you declare in the .rvmrc file.
To remove this constraint, simply edit the .bundle/config file and delete the file declaring BUNDLE_PATH, e.g.,
BUNDLE_PATH: /usr/local/lib/
Look in rvm env gemdir, also check what you've got set in .rvmrc in terms of a gemset. Do bundle install and it should get all the gems.
Check .bundle by doing $ cat .bundle to see its content , and check if it is copying the gems to vendor/ruby. This will only be the case if bundle install --path vendor/ruby was supplied (Ref).
Authlogic has a couple unfortunate deprecation warnings that are fixed in a fork.
How do I use this forked version? I tried adding the following to my Gemfile:
gem 'authlogic', :git => 'git://github.com/railsware/authlogic.git'
And it didn't work quite that well. I started getting:
git://github.com/railsware/authlogic.git (at master) is not checked out. Please run bundle install
And
The git source git://github.com/railsware/authlogic.git is not yet checked out. Please run bundle install before trying to start your application
Assistance will be rewarded with virtual cookies.
Have you tried running bundle install after removing Gemfile.lock?
rm Gemfile.lock
bundle install
Your Gemfile configuration should work, I was able to use the same for and my bundle install command executes as does my bundle list command.
My other suggestion would be removing you ~/.bundler and .bundle directories and checking that you have properly configured git.
You need to run bundle install from the terminal after updating your Gemfile.
I'm pretty new to Ruby/Rails but I was taking a look at bundler and was wondering how it works exactly. Do you install a full set of gems like normal gem install XYZand then use the Gemfile to pull a certain subset of those gems for use with a specific application? Or do you not install gems normally anymore and just include them in the Gemfile and then do a bundle install to include them all in a bundle that is then used with your application?
Thank you so much for taking the time to answer this, I'm just a little confused on what bundler's functionality is exactly.
-- MAP
These two links explain everything about bundler.
How does bundler bundle
How does bundle require gems
Think of bundler as a package management tool.
From bundle help command:
bundle install # Install the current environment to the system
bundle package # Locks and then caches all of the gems into vendor/cache
So bundle install command will install all gems to the system that are listed in Gemfile as well as their dependencies. If the gem was not previously installed it will grab it from the gemcutter repo. bundle package will cache the .gem files into your apps vendor/cache directory.
No need to run gem install first.