12

I need to install json because I get this error:

Could not find json-1.4.6 in any of the sources

I ran gem install json and bundle install but I was only able to install json-1.5.1 when I need json-1.4.6

I have gem 'json', '1.4.6' in my gemfile, so I'm not sure what's going on...

UPDATE

I get this error:

Installing json (1.4.6) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1216:in `chmod': Operation not permitted - /Library/Ruby/Gems/1.8/gems/json-1.4.6/CHANGES (Errno::EPERM)

7 Answers 7

10

After checking logs by running $ heroku logs

I found "An error occurred while installing json (1.4.6), and Bundler cannot continue. Make sure that gem install json -v '1.4.6' succeeds before bundling."

I then removed 2 json entries from the Gemfile.lock and had no further issues.

Sign up to request clarification or add additional context in comments.

Comments

9

Why did you run gem install json at all? Bundler takes care of that for you and will ensure that the correct version of each gem is installed (since sometimes dependencies require an older version). Run

gem uninstall json bundle install 

Also ensure you have source 'https://rubygems.org' at the top of your Gemfile.

As for the permissions info, you may have to run gem and bundle commands with sudo.

By the way, I highly recommend taking a look at and using RVM, particularly the gemsets feature. It will make your life infinitely better when developing Ruby apps. If you decide to do so, I'd also suggest trashing all the gems you've install using the system Ruby by running sudo rm -rf /Library/Ruby/Gems/1.8/. It's also important that when using RVM you don't have to use sudo when running gem (or bundle), which is not only safer but less typing too.

8 Comments

Ok I did that. I have source 'http://rubygems.org at the top. I still get this error: Could not find json-1.4.6 in any of the sources
Are you running bundle install with or without sudo?
with, check the question again, I added more information on the install error
Okay, try running sudo gem uninstall json again, make sure that gem list doesn't show it being installed. Then sudo rm -rf /Library/Ruby/Gems/1.8/gems/json-1.4.6/. Then try sudo bundle install again.
btw, check out this problem of mine if you have time: stackoverflow.com/questions/5215552/…
|
8

Please update your rubygems by executing the following command..

gem update --system 

may be it will solve the problem. After updating your gem. Then run the following command to install json

gem install json 

Now you can get json gem installed in your system.

Comments

3

Try: $ sudo apt-get install ruby1.8-dev

Comments

0

If you're using rbenv, try rbenv rehash

Comments

0

I had this problem when trying to build a website with Jekyll.

Turned out I hadn't followed all the instructions at https://jekyllrb.com/docs/installation/ubuntu/

I don't know if it was the missing packages or commands into ~/.bashrc but it fixed the problem in two instances of Ubuntu in WSL

Comments

-2

Remove the json entries from the Gemfile.lock file and try to re run bundle install..

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.