json_pure/rubygems cyclic dependencies - ruby

I have an issue when trying to set up rvm, where gems weren't installing due to them being dependent on json_pure. I tried to install json_pure, but rubygems itself seems to depend on json_pure. I have tried removing all versions of json_pure, but rubygems still complains.
$ sudo gem install json_pure
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)
I have tried downloading the gem and installing it locally, but rubygems still complains about the dependency.

I had this exact problem, and the above solutions didn't work for me. (I don't use rvm, and re-installing RubyGems didn't resolve the issue.)
This is what I did to fix my setup on my Mac. (Ruby 1.8.6, Mac OS X 10.5.8)
1) Go to http://rubygems.org/gems/json_pure
2) Download the json_pure gem to ~/Downloads
3) cd ~/Downloads/
4) sudo gem install json_pure-1.4.6.gem
(You'll still see the "Could not find RubyGem json_pure" error, but the install does work. To double-check you can redo 'sudo gem install json_pure-1.4.6.gem' and you shouldn't see the error the second time.)
5) Verify that json_pure is now installed:
gem list

I fixed this issue by copying the json and json_pure gems and their specs from a working ruby directory into the .rvm gem directory of the broken ruby. Not sure why rubygems itself ever relies on another gem.
cp -r ~/.rvm/gems/ruby-1.8.7-p249/gems/json* ~/.rvm/gems/ruby-1.8.6-p399/gems/
cp -r ~/.rvm/gems/ruby-1.8.7-p249/specifications/json* ~/.rvm/gems/ruby-1.8.6-p399/specifications/

I can't understand if you are having an issue installing RVM or using RVM.
If you need to install RVM, don't use sudo.
Just type
$ gem install rvm
RubyGems will install it in your home directory.
Then, proceed with rvm-install and follow the instructions.
When using RVM, never use sudo.

This issue came about when I removed all the json-pure versions in my main $PATH. To resolve the issue I reloaded RubyGems 1.3.7 from source and was able to reinstall the json-pure gem. Note: I was not using RVM.
Steps:
1) Download RubyGem 1.3.7.tgz
2) Use these commands at the command prompt
tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo /opt/local/bin/ruby setup.rb
3) Try a gem command
gem list
4) If it works, install the json-pure gem // might need to install the json gem also.
sudo gem install json
sudo gem install json-pure

Related

Issues serving Jekyll to localhost, eventmachine 1.2.7 has an error when installing

Not sure what to do to specifically fix this problem, googled and nothing solved my question. When I try to:
bundle exec jekyll serve
I get told:
Could not find eventmachine-1.2.7 in any of the sources
Run `bundle install` to install missing gems.
Then I:
bundle install
Only to get this:
Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /private/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201130-34411-pd54nh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7 for
inspection.
Results logged to
/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/extensions/universal-darwin-20/2.6.0/eventmachine-1.2.7/gem_make.out
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
minima was resolved to 2.5.1, which depends on
jekyll-feed was resolved to 0.13.0, which depends on
jekyll was resolved to 4.0.0, which depends on
em-websocket was resolved to 0.5.1, which depends on
eventmachine
Where am I going wrong here? Just updated to macOS 11.0.1, this is my first time trying to serve jekyll since the update. Thanks y'all!
Just try:
gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
I had the same problem on Big Sur and this solution worked perfectly:
How to fix Jekyll after upgrading to MacOS 11 (Big Sur)
Download XCODE 12 beta from here and copy it to the Applications folder.
Then follow these steps to install rbenv.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. see: https://github.com/rbenv/rbenv#basic-github-checkout
xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Now in your Jekyll project's root, you should be able to run bundle install and it should install all missing dependencies and should work now.
I didn't have to build ruby or install XCode. While Jekyll requires Ruby 2.4.0 or higher and Big Sur comes with 2.6.3, I followed Jekyll's instructions to install the latest version of Ruby.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby
Add Ruby to your shell configuration in .bash_profile.
PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH
Install bundler. I had to upgrade to Jekyll 4.2 from 4.0, and install webrick which is no longer a default gem with Ruby 3.0. If Jekyll is installed globally, then install it, webrick, and any other gems, like jekyll-paginate, too.
gem install --user-install bundler jekyll
Add the gems path to your shell configuration in .bash_profile, replacing X.X with with first two digits of the Ruby version.
PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"
export PATH

Why do I get "ERROR: While executing gem ... (Gem::FilePermissionError)"?

I uninstalled RVM and re-installed using a single user installation using:
\curl -L https://get.rvm.io | bash -s stable
When I do bundle, it prompts for:
Enter your password to install the bundled RubyGems to your system:
I tried using the answer in "ERROR: While executing gem … (Gem::FilePermissionError)" which did not fix it.
Then, while trying to install the gem manually, I got:
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
then running gem install nokogiri -v '1.6.0' returned:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
I checked all the similar posts on SO, but they didn't solve the problem. What am I missing?
I spent a lot of time fixing this issue on my MacBook. The gem update --system does not work for me.
At last, putting the following code in the ~/.zshrc file and create a new zsh session works for me.
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
after you install RVM you still need few more steps:
Load RVM to the current shell:
source ~/.rvm/scripts/rvm
Usually this would not be needed if you close and open your terminal again
Install ruby:
rvm install ruby
Use ruby:
rvm use ruby
The last step is very important as your error message mentioned system ruby not the one controlled by RVM.
Make sure to update your system rubygems with this command : sudo gem update --system --no-user-install.
bundler use it instead your local version and your bundler version could be incompatible with your system rubygems.
It works for me ;)

how to update gem command in ubuntu?

my gem version is 1.3.5 and I can't install certain gems because of that.I tried to update the gem on my computer by
sudo update --system
and it gives me an error
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian.
RubyGems can be updated using the official
Debian repositories by aptitude or apt-get.
so according to some people, the source need to be downloads and it needs to executed by ruby. i downloaded the file, did
sudo ruby setup.rb
and it gave me
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
1 bug fix:
Install the .pem files properly. Fixes #320
Remove OpenSSL dependency from the http code path
RubyGems installed the following executables:
/usr/bin/gem1.8
but when I hit ruby gem -v it still gives me 1.3.5 rather than the one I installed which is 1.8.
Do I need to uninstall the older version manually? or some other thing I need to do first?
RubyGems installed the following executables: /usr/bin/gem1.8
As the line says, the name of the program is gem1.8, not gem. Ergo, you need to call
gem1.8 -v
not
gem -v
Please try make a symbolic link.
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

RubyGems - my system can't seem to find any remote gems to install

Trying to install the 'less' gem. I type sudo gem install less as instructed at http://lesscss.org/, and I get the following error:
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find less (> 0) in any repository
Alright, so I figure maybe I just need to update RubyGems. Trying 'gem update --system' gets me
Updating RubyGems...
Attempting remote update of rubygems-update
ERROR: While executing gem ... (Gem::InstallError)
rubygems-update requires builder >= 0
Arrgh. Alright, then let's try 'sudo gem install builder':
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find builder (> 0) in any repository
Seems that no matter what gem I try to install, it can't be found in any repository. I check my environment, and rubyforge is listed:
RubyGems Environment:
- VERSION: 0.9.4 (0.9.4)
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- GEM PATH:
- /usr/local/lib/ruby/gems/1.8
- REMOTE SOURCES:
- http://gems.rubyforge.org
Any idea what's going on? I'm on OSX 10.4, and I installed Ruby 1.8.6 before this.
I think rubygems 1.3.x requires ruby 1.8.7 so you might install that first. Then update rubygems to 1.3.7. via gem update --system
The version of rubygems bundled in osx uses gemforge as its offical source of gems - this has since been replaced with gemcutter. You should be able to do
sudo gem update --system
To upgrade to update the latest version of ruby gems, which will then use gemcutter as the sources link
That's a really old version of rubygems! How did you install this?
Is it a manual install? If so, perhaps you could try a manual upgrade the same way.
Do the following:
sudo gem update --system
to update your install of RubyGems. Then, add the Github gem repository to your sources. I suggest github because you'll find a lot of useful things there:
sudo gem sources -a http://gems.github.com

Ruby Gem package manager failing with Gem::GemNotFoundException

I haven't used Ruby for a while on my Mac. Obviously something has changed in my environment as gem is no longer working as it should.
Some info from my machine, running OSX 10.5.8:
% gem --version
0.9.0
% gem env
Rubygems Environment:
- VERSION: 0.9.0 (0.9.0)
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- GEM PATH:
- /usr/local/lib/ruby/gems/1.8
- REMOTE SOURCES:
- http://gems.rubyforge.org
The error I'm seeing is:
% sudo gem update --system
Password:
Updating RubyGems...
Attempting remote update of rubygems-update
ERROR: While executing gem ... (RuntimeError)
rubygems-update requires builder >= 0
Or if I try to install a new gem:
% sudo gem install bossman
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find bossman (> 0) in the repository
Some people have recommended clearing out the source_cache file, but this didn't help me. Others recommended:
% gem clean
Cleaning up installed gems...
Clean Up Complete
But that also doesn't help.
Can someone please help me get gem working again? Any insight into the reasoning behind this would be helpful. I know sufficiently little about Ruby and gem to find these error messages cryptic.
EDIT
I tried Derick Bailey's suggestion, but without any luck:
% sudo gem install rubygems-update update_rubygems
Password:
ERROR: While executing gem ... (RuntimeError)
rubygems-update requires builder >= 0
your version of rubygems should support updating, but it's obviously not working. I've been seeing this a lot recently - not just on osx, either.
the "easy" answer is to either re-install your ruby runtime with an updated version of rubygems already packaged with it, or you can install an updated version of rubygems.
for complete instructions on installing rubygems, see http://docs.rubygems.org/read/chapter/3
try running this: gem install rubygems-update update_rubygems
if that doesn't work, you'll need to manually update, which can be done with these instructions: http://docs.rubygems.org/read/chapter/3#page13
Ugh, I thought I had fixed these legacy indexes so update_rubygems worked...I guess not. The main problem here is your version of RubyGems is very old, and you'll need to update. Since you can't install gems, (none are listed in the legacy index, in an effort to get you to update) the best thing to do would be to download the .tgz/.zip from http://gemcutter.org/pages/download and run sudo ruby setup.rb.

Resources