I'm trying to set up a ruby project and rather new to the process of automating via bundle. However when I try to execute any bundle command I'm met with the following error:
/usr/local/bin/bundle:26:in `load': cannot load such file -- /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/exe/bundle (LoadError)
from /usr/local/bin/bundle:26:in `<main>'
I have tried removing and reinstalling Ruby, as well as removing the bundler gem itself. But to no avail. My Rubygems version is 2.3.0 and the Ruby version is 2.3.1 which is the latest stable version for Ubuntu
Problem related to bundler==1.16.1 try to reinstall with bundler=1.16.0 for now.
gem uninstall bundler -x
gem install bundler -v 1.16.0 --force
More info and bug report can be found here: https://github.com/bundler/bundler/issues/6227
I was able to uninstall bundler -v '1.16.1' as described by Mr.Coffee, but in gem list it was still listed and marked as default.
I created a symlink then - very hacky, but the only thing which worked for me:
ln -sf /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.0 /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1
The gem requesting bundler works now.
Related
I am pretty new to ruby and rails development, And I am working on linux subsystem for windows. I have been getting the above mentioned error. Here's what all I have done:
reinstalled rvm
added export PATH="$PATH:/usr/bin:/usr/local/bin/:/usr/share/rvm/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin" the path in .zshrc file
but the problem is still persisting. another thing I know is rvm is installed in /usr/share/ directory
I have also referred this link:
problem with bundle
Any help would be greatly appreciated!!
I can suggest you to run which bundle command. The path it returns contains a ruby version. I'm almost sure that you won't have this ruby version on your local machine. Check that by running rvm list. To solve the problem try either installing the version of ruby or reinstalling bundler using sudo and gem- sudo gem uninstall bundler - > sudo gem install bundler.
NOTE: your ruby version has to be the same with the one in the Gemfile.
I believe I am having some PATH issues for my gems.
I am using rvm (version 1.29.3) with ruby (version 2.4.1) and rails (version 5.1.4)
I tried to run rails new myapp to which I get the following LoadErrors:
remove config/initializers/new_framework_defaults_5_1.rb
run bundle install
/Users/fabienbessez/.rvm/rubies/ruby-2.4.1/bin/ruby: No such file or directory
-- /Users/fabienbessez/.rvm/rubies/ruby-
2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
run bundle exec spring binstub --all
/Users/fabienbessez/.rvm/rubies/ruby-2.4.1/bin/ruby: No such file or directory
-- /Users/fabienbessez/.rvm/rubies/ruby
2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
I get the same error when I try to then run bundle install
I checked the contents of ~/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems to which I found that bundler-1.15.4 but not bundler-1.16.0. I assume that that is the issue. But I can't figure out how to update those gems. gem install bundler says it has installed bundler 1.16.0 but this is not being updated.
Any ideas??
Thanks!
Have you tried to uninstall all old versions of bundler with gem uninstall bundler?
I get the following error when attempting to run cap production deploy.
DEBUG [dc362284] Bundler::GemNotFound: Could not find json-1.8.1.gem for installation
DEBUG [dc362284] An error occurred while installing json (1.8.1), and Bundler cannot continue.
DEBUG [dc362284] Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
It may be important to note that this deployment was working, than I upgraded to Ruby 2.1.0 to remove an encoding error. I upgraded locally which worked fine. I ran rvm install 2.1.0 and rvm use 2.1.0 then changed my .ruby-version file to reflect this Ruby upgrade.
The bundle install command works locally, but produces the same above error when I ssh onto the destination server and run this command.
If I run gem list I can see this in the list of gems.
...
jquery-rails (3.0.4)
json (1.8.1)
less (2.3.2)
...
If I try the recommended solution gem install json -v '1.8.1' Locally and on the destination server I get the following output:
Building native extensions. This could take a while...
Successfully installed json-1.8.1
Parsing documentation for json-1.8.1
Done installing documentation for json after 0 seconds
1 gem installed
So it appears the gem is installed, right? Why is this happening? How can I solve this? Any help would be greatly appreciated.
$ bundle update json
$ bundle install
So after a half day on this and almost immediately after posting my question I found the answer. Bundler 1.5.0 has a bug where it doesn't recognize default gems as referenced here
The solution was to update to bundler 1.5.1 using gem install bundler -v '= 1.5.1'
Run this command then everything will be ok
sudo apt-get install libgmp-dev
if you are in MacOS Sierra and your ruby version is 2.4.0.The ruby version is not compatible with json 1.8.3.
You can try add this line in your Gemfile:
gem 'json', github: 'flori/json', branch: 'v1.8'
This works for me!
To solve this problem, simply run:
bundle update
It will update the version of your bundler. Then run:
bundle install
Your problem will get solve. Solution is well explained here.
I found the solution here. There is a problem with json version 1.8.1 and ruby 2.2.3, so install json 1.8.3 version.
gem install json -v1.8.3
You should try
$ sudo gem install json -v '1.8.2'
in my case (Ubuntu 14.04) that didn't work directly and I had to do this:
$ sudo apt-get install ruby-dev
and then I could install the gem and continue. Had one more problem that was fixed by:
$ sudo apt-get install libsqlite3-dev
Hoping helps.
If the recommended answer didn't help because you are already using a newer version of bundler. Try the solution that worked for me.
Delete everything inside your vendor folder.
Add a line to your gemfile
gem 'json', '1.8.0'
Then run - bundle update json.
It seems to be an issue with 1.8.1 so going back to 1.8.0 did the trick for me.
I ran into this error while trying to get a project to run on my local dev box (OSX 10.6), using Sinatra and Postgresql (through activerecord), running on an rvm'd ruby 2.1. I found my answer here: https://github.com/wayneeseguin/rvm/issues/2511
My exact problem (after the first block of log entries):
I also get an error when trying to build native extensions for gems
The answer:
rvm reinstall 2.1.0 --disable-binary
The explanation:
OSX does not have a package manager so all libraries have to be installed manually by user, this makes it virtually impossible to link the binary dynamically, and as you can see there are problems with the (pseudo)statically linked binary.
For the sake of completeness, I had first forgotten to update rvm (rvm get head), which yielded some other errors, but still needed the --disable-binary flag once I had done so.
bundle update json. Helped to get through.
When I tried to install the json gem using gem install json separate from just using bundle install I got ERROR: Failed to build gem native extension., looking that up I found using
apt-get install ruby-dev
did the trick
For OS X make sure you have coreutils
$ brew install coreutils
$ bundle
This appears to be a bug in Bundler not recognizing the default gems installed along with ruby 2.x. I still experienced the problem even with the latest version of bundler (1.5.3).
One solution is to simply delete json-1.8.1.gemspec from the default gemspec directory.
rm ~/.rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/specifications/default/json-1.8.1.gemspec
After doing this, bundler should have no problem locating the gem. Note that I am using chruby. If you're using some other ruby manager, you'll have to update your path accordingly.
I was missing C headers solution was to download it for Xcode, this is the best way.
xcode-select --install
Hope it helps.
Bundle was failing to install json -v '1.8.1' and deleting my Gemfile.lock and running bundle again solved this issue for me.
I installed the latest version of json:
gem install json
Then deleted the line json(1.8.1) from the Gemfile.lock and did a
bundle install
And then the Gemfile.lock file uses json(1.8.3) without erros
Switch ruby version from 1.9 to 2.2 with rvm did the job for me
For me, some of the answers mentioned earlier were helpful from understanding point of view, but those didn't solve my problem.
So this is what I did to solve issue.
Modified gemfile.lock to update json (2.0.2) (Earlier, it was 1.8.3)
Check the Bundler version installed (Bundler -v command). I had version 1.12.5 installed
Install bundler version 1.11.2 (using gem install bundler -v '1.11.2')
Then run bundle install
For macOS Sierra:
I ran into this error When i used bundler(v1.15.3) in Rails(v4.2) project.
The solution for me is gem uninstall bundler -v '1.15.3' and gem install bundler -v '1.14.6'.
I am using Bundler for my Rails application. When I list installed bundler gems it lists 1.4.0.pre.1 and 1.3.15 and running bundler -v yields 1.4.0.pre.1 (which is what i want).
However, when I try to run my application it says current bundler version is 1.0.15. This version is not installed as a gem and I cannot figure out how to remove it (gem uninstall bundler -v 1.0.15 wont work since this version is not installed as a gem).
I have tried updating and installing new versions, but nothing is working. Please help, I've been stuck for hours. Thank you.
Try running:
$ which -a bundle
This will tell you the location of all the instances of bundler found on your computer.
From there, you should be able to locate the offending version of bundler and uninstall it.
This worked for me when using vagrant
[vagrant#precise32:/vagrant (master)]$ sudo gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
1 gem installed
try running this on you app console:
bundle update
When I try to do bundler update I get this error:
.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
`to_specs': Could not find bundler (>= 0) amongst
[rake-0.8.7, rake-0.8.7, rubygems-update-1.8.4] (Gem::LoadError)
I'm new to Ruby, can someone tell me what would cause this? Rake 0.8.7 is installed.
Make sure you're entering "bundle" update, if you have the bundler gem installed.
bundle update
If you don't have bundler installed, do gem install bundler.
I had this problem, then I did:
gem install bundler
then in your project folder do:
bundle install
and then you can run your project using:
bundle exec rails server
I had the same problem. This worked for me:
run rvm/script/rvm and also add it to your .profile or .bash_profile as shown in https://rvm.io/rvm/install/
use bundle without sudo
If You are using rvm, then try the following command:
rvmsudo gem install bundler
According to another question: Could not find rails (>= 0) amongst [] (Gem::LoadError)
Hope it helped,
Cheers
The command is bundle update (there is no "r" in the "bundle").
To check if bundler is installed do : gem list bundler or even which bundle and the command will list either the bundler version or the path to it. If nothing is shown, then install bundler by typing gem install bundler.
I had the same problem .. something happened to my bash profile that wasn't setting up the RVM stuff correctly.
Make sure your bash profile has the following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Then I ran "source ~/.bash_profile" and that reloaded everything that was in my bash profile.
That seemed to fix it for me.
According to this answer to a similar question, it should be enough:
rvmsudo gem install bundler.
Cheers
If you're using rbenv running rbenv rehash can solve this after you've installed bundler and are still getting the issue.
You may have to do something like "rvm use 1.9.2" first so that you are using the correct ruby and gemset. You can check which ruby you are using by doing "which ruby"
I had this same concern when setup a new Bundler gem version (2.2.11) on my machine.
I was getting the error below:
/home/username/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': Could not find 'bundler' (2.2.11) required by your /home/username/Projects/my_project/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.11`
17: from /home/username/.rbenv/versions/2.7.2/bin/rspec:23:in `<main>'
16: from /home/username/.rbenv/versions/2.7.2/bin/rspec:23:in `load'
15: from /home/username/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rspec-core-3.10.1/exe/rspec:4:in `<top (required)>'
14: from /home/username/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:45:in `invoke'
Here's how I achieved it:
First, I had already installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11
Next, I listed my Bundler versions:
gem list bundler
Finally, I updated my gems to use the newly installed Bundler:
gem update --system
That's all.
I hope this helps
I got this after upgrading to ruby 2.1.0. My PATH was set in my login script to include .gem/ruby/2.0.0/bin. Updating the version number fixed it.
The system might be running "rootless". Try to set the firmware nvram variable boot-args to "rootless=0".
Try to run set of commands:
sudo nvram boot-args="rootless=0";
sudo reboot
After reboot completes, run:
sudo gem install bundler
Can be related to https://github.com/bundler/bundler-features/issues/34 if you are running the command inside another bundle exec. Try using Bundler.with_original_env if that is the case.
For anyone encountering this issue with Capistrano: capistrano isn't able to locate the bundler. The reason might be that you installed bundler under some other gemset where the Capistrano isn't even looking.
List your gemsets.
rvm gemset list
Use a particular gemset.
rvm use 'my_get_set'
Install bundler under that gemset.
gem install bundler
Then, try again with the deploy task.
I resolved it by deleting Gemfile.lock and gem install bundler:2.2.0
In my case I believe I had an old Ruby remaining on the system, not registered on rvm, and even if the path variables and gem list was okay, it would still use the old Ruby during deployments with Capistrano
And then I realized, the Ruby I had installed with rvm wasn't set to the default one. Running
rvm alias create default <rvm_registered_ruby>
Fixed it.
Just in case, I had similar error with bundler 2.1.2 and solved it with:
sudo gem install bundler -v 1.17.3
If you have several bundler versions installed, then you can run specific version of bundle this way: bundle _1.17.3_ exec rspec
Though seems like later bundler versions are pretty buggy (had issues on 3 different projects on 2 operation systems), having one old bundler may work the best, at least this is what I have on my Ubuntu & MacOS
Latest bundler versions may override stable bundler -v 1.17.3.
It can be not easy to remove latest bundler from system, here is what helped me:
Remove default version from gem env gempath: https://stackoverflow.com/a/60550744/1751321
Remove rm bundler.rb && rm -rf bundler folder from load paths: ruby -e 'puts $LOAD_PATH'
Then reinstall stable gem install bundler -v 1.17.3 (Not sudo! it is important)
Script ruby fix_bundler.rb
require 'fileutils'
load_paths = `ruby -e 'puts $LOAD_PATH'`
load_paths.split.each do |path|
target = File.join path, "bundler.rb"
if File.exist? target
puts "Deleting #{target}"
File.delete target
end
target = File.join path, "bundler"
if File.directory? target
puts "Deleting #{target}"
FileUtils.rm_rf target
end
end
Gem.paths.path.each do |path|
path_mask = File.join path, "specifications", "default", "bundler*"
Dir[path_mask].each do |target|
puts "Deleting #{target}"
FileUtils.rm_rf target
end
end
puts "✅ bundler fixed"