I get errors when I run "bundle install" on zsh - ruby

I'm having an error messages with trying to run "bundle install". My ruby version is 2.2.0. Also, I installed it with rvm and did an "rvm use" command to change it from 2.4.0 to 2.2.0 because I thought it might fix the error. Anyway I need your help. Much appreciated.
I currently have 3 versions of ruby : 2.2.3, 2.2.0, 2.4.0
My OS MAC OS Sierra 10.12.3
My shell is zsh.
/Users/root/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
from /Users/root/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:298:in `activate_bin_path'
from /usr/local/bin/bundle:22:in `<main>'
from /Users/root/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
from /Users/root/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

It seems you have not installed gem bundler. Try:
gem install bundler
then bundle install again.

Not exactly sure what the issue was. But going into my .gemrc file and deleting
install: "--user --no-document"
update: "--user --no-document"
solved the problem

Related

How to get Cocoapods running with RVM?

Unfortunately, I recently upgraded the system Ruby to 2.3 on my Mac. Since I have to use Cocoapods 0.39 for a specific project which does not properly work, I would like to use an older version of Ruby. For this purpose, I installed RVM and then switched to ruby-2.2-head:
> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> rvm install 2.2-head
> rvm use 2.2-head --default
This worked fine. Then I tried to install Cocoapods and got the usual error message:
> rvmsudo gem install cocoapods
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
which I silenced by chosing the second option. Then I checked Cocoapods and got a fantastic error message:
> pod --version
/Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:278:in `activate_bin_path'
from /Users/bastian/bin/pod:22:in `<main>'
Furthermore, Cocoapods is not listed with the following command:
> gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
Cocoapods seems to be installed into the wrong directory:
> which pod
/Users/bastian/bin/pod
So if I switch back to the system Ruby, the pod --version command returns 0.39.0.
I guess that somehow Cocoapods was not installed with the RVM Ruby but rather with the system version. What did I do wrong?
With the help of "How to get RVM to set correct gem path" I was able to solve the problem. I don't know why but the removal of the single entry --user from .gemrc solved this problem for me. Since the file only contained this one line I just renamed it and reinstalled Cocoapods:
> mv ~/.gemrc ~/.gemrc_backup
> gem install cocoapods`
Now Cocoapods is working again as it resides at the correct path:
> which pod
/Users/bastian/.rvm/gems/ruby-2.2-head/bin/pod

Error running Jekyll on OS X Yosemite 10.10.5

I have a problem running Jekyll on OS X Yosemite 10.10.5. When I run jekyll serve, I get the following error:
MacBook-Pro-Svetlana:iloveip svetlana$ jekyll serve
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'jekyll' (>= 0) among 22 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/jekyll:22:in `<main>'
MacBook-Pro-Svetlana:iloveip svetlana$
I had to reinstall OS X Yosemite. And I might have done something wrong. First, I installed Xcode Command Line Tools without actually installing Xcode. Then I followed instructions on this site to install Ruby and Git. After that I installed Jekyll but it wasn't running with jekyll serve. So I installed Xcode, but still got some errors.
So I upgraded RVM, and also upgraded Ruby to 2.2.3. After that I uninstalled and installed Jekyll once again. But when I try to run it I get the error above.
What can I do to fix it?
Hmmm. New problem seems that you have a problem with gem sources.
Re-generating sources can help.
$ gem sources --remove https://rubygems.org/
$ gem sources -a http://rubygems.org/
$ gem install jekyll
And now, install Jekyll again.

Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources

I'm just trying to learn to write the example-output-plugin,follow this page:
http://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html#_clone_and_test_4
when I type the "bundle install" in the folder ~/logstash-output-example,I get the the error:
Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources
listed in your Gemfile or installed on this machine.
it seems the gem 'logstash-devutils (>= 0) ruby' missed,but when I type the
"sudo gem install logstash-devutils", I get the error
ERROR: Could not find a valid gem 'logstash-devutils' (>= 0)
Here is why:
Found logstash-devutils (0.0.12), but was for platform java
Anyone else can help me?
environment:MAC OSX 10.9.5
I just ran into the same problem. Solved it by just downloading the gem via the download link on its rubygems.org page and installing it with:
sudo gem install logstash-devutils-0.0.13-java.gem
That worked for me.
Update:
Well, that will install the gem but it will not solve the real problem. I needed to switch to jruby for the tutorial to work. This can be done via the RVM:
sudo rvm install jruby
I tried installing the gem manually and got a different error:
There was a RuntimeError while loading logstash-devutils.gemspec:
Only JRuby is supported from
/Users/bnewton/.rvm/gems/ruby-2.2.1/bundler/gems/logstash-devutils-15c59bfaab59/logstash-devutils.gemspec:2:in `'
This leads me to believe the logstash-devutils requires jruby rather than the usual ruby. I use rvm, so it was a matter of installing and using jruby instead of regular ruby. So if you are using rvm, run:
rvm install jruby-1.7.19
rvm use jruby-1.7.19
gem install bundler
bundle install
This fixed it for me, and I was able to run bundle install without error.

Cocoapod error right after installing successfully

I installed CocoaPods :
retine:MacOS jdmuys$ sudo gem install cocoapods
[...]
Successfully installed cocoapods-0.29.0
1 gem installed
Installing ri documentation for cocoapods-0.29.0...
Installing RDoc documentation for cocoapods-0.29.0...
However, it doesn't seem to work:
retine:MacOS jdmuys$ pod --version
/Users/jdmuys/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find cocoapods (>= 0) amongst [addressable-2.3.2, bundler-1.2.3, chunky_png-1.2.6, compass-0.11.7, cookiejar-0.3.0, daemons-1.1.9, em-http-request-1.0.3, em-socksify-0.2.1, erubis-2.7.0, eventmachine-1.0.0, extlib-0.9.15, fssm-0.2.9, haml-3.1.7, http_parser.rb-0.5.3, json_pure-1.4.6, rack-1.4.1, rake-10.0.3, rubygems-bundler-1.1.0, rvm-1.11.3.5, sass-3.1.21, sproutcore-1.9.1, thin-1.2.11, thor-0.14.6] (Gem::LoadError)
from /Users/jdmuys/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/jdmuys/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /Users/jdmuys/.rvm/rubies/ruby-1.9.3-p327/bin/pod:22:in `<main>'
FWIW:
retine:MacOS jdmuys$ xcode-select --print-path
/Applications/Xcode51-Beta4.app/Contents/Developer
(doesn't help if I switch to a non beta version of Xcode)
and
retine:MacOS jdmuys$ ruby --version
ruby 1.9.3p327 (2012-11-10) [x86_64-darwin12.2.0]
Any idea what is happening and what I can do to fix it?
Thanks
I ran into a similar issue, and re-installing without sudo – gem install cocoapods – fixed the issue for me.

Can't install RubyZip gem on OS X Lion with RVM

TL;DR:
$ gem install rubyzip
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
And now in detail. I'm not sure which information is relevant, so I'm just gonna say it all.
I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
Everything worked just fine for a while
Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
The warning kept on popping up, so I tried to remove the gemset with rvm gemset empty, which also failed, because of some permission denied error (yes stupid me didn't write it down)
In result of that, I reinstalled Ruby via rvm remove 1.9.2 and rvm install 1.9.2 (I didn't forget to rvm use 1.9.2 --default after that.
I installed bundler gem install bundle and then tried to bundle install in my Rails 3.1.1 project, but it ends with error
Installing rubyzip (0.9.4)
Errno::EPERM: Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
An error occured while installing rubyzip (0.9.4), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '0.9.4'` succeeds before bundling.
gem install rubyzip -v '0.9.4' gives the above mentioned error
The README file says to download source and install from there via ruby install.rb, which also ends in error
$ ruby install.rb
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:841:in `install': wrong number of arguments (4 for 3) (ArgumentError)
from install.rb:21:in `block in <main>'
from install.rb:18:in `each'
from install.rb:18:in `<main>'
Even executing tests fro rubyzip ends up in bunch of errors
$ rake test
rake/gempackagetask is deprecated. Use rubygems/package_task instead
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -C test alltests.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- stdrubyexttest (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from alltests.rb:5:in `<main>'
rake aborted!
Command failed with status (1): [/Users/darth/.rvm/rubies/ruby-1.9.2-p136/b...]
Tasks: TOP => test
(See full trace by running task with --trace)
I'm out of ideas, what can I do?
I'm really not sure what caused this, but I managed to fix it by doing the following.
Since reinstalling Ruby 1.9.2 didn't help, I decided to be even more drastical and went down to rvm. I found out that I had version 1.1.something installed, which is about 9 months old.
I tried to update, but it didn't help, so rvm implode did the trick. I even had to sudo rm -rf ~/.rvm, probably because I managed to mess up some gem installs by adding sudo to them.
After reinstalling rvm and reinstalling 1.9.2, it seems like everything is working fine now, even with Xcode 4.2.
Lesson learned, rm -rf & reinstall is better than trying to upgrade from a year old version :)

Resources