Why won't the package install JSON?

When I try to start cap production deploy I get the following error.

 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. 

Perhaps it is important to note that this deployment worked than I upgraded to Ruby 2.1.0 to remove the encoding error. I updated locally, which worked great. I ran rvm install 2.1.0 and rvm use 2.1.0 and then modified my .ruby-version file to reflect this Ruby update.

The bundle install command works locally, but produces the same error above when I ssh on the target server and run this command.

If I run the gem list , I see this in the gem list.

 ... 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 target 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 seems that the stone is installed, right? Why is this happening? How can i solve this? Any help would be greatly appreciated.

+67
ruby-on-rails gem bundler capistrano
Jan 13 '14 at 15:31
source share
18 answers

So, after half a day on this and almost immediately after the publication of my question, I found the answer. Bundler 1.5.0 has an error in which it does not recognize the default aircraft, as indicated here

The solution was to upgrade to package 1.5.1 using gem install bundler -v '= 1.5.1'

+66
Jan 13 '14 at 15:41
source share

Run this command, then everything will be fine

 sudo apt-get install libgmp-dev 
+46
Dec 12 '15 at 16:04
source share

if you are on MacOS Sierra and your ruby ​​version is 2.4.0. The ruby ​​version is not compatible with json 1.8.3.

You can try adding this line to your Gemfile:

gem 'json', github: 'flori/json', branch: 'v1.8'

It works for me!

+38
Jan 04 '17 at 4:53 on
source share
 $ bundle update json $ bundle install 
+35
Apr 13 '16 at 19:23
source share

I found a solution here . There is a problem with json version 1.8.1 and ruby ​​2.2.3, so install json version 1.8.3.

 gem install json -v1.8.3 
+20
Apr 6 '16 at 19:11
source share

You must try

 $ sudo gem install json -v '1.8.2' 

in my case (Ubuntu 14.04), which did not work directly, and I had to do this:

 $ sudo apt-get install ruby-dev 

and then I can set the gem and continue. There was another issue that was fixed:

 $ sudo apt-get install libsqlite3-dev 

Reliable help.

+12
Aug 10 '16 at 0:54
source share

To solve this problem, simply run:

bundle update

It will update the version of your provider. Then run:

bundle install

Your problem will be resolved. The solution is well explained here .

+12
Apr 13 '17 at 9:38 on
source share

I ran into this error while trying to run a project in my local dev block (OSX 10.6) using Sinatra and Postgresql (via activerecord) while working on 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 create my own gem extensions

The answer is:

rvm reinstall 2.1.0 --disable-binary

:

OSX does not have a package manager, so all libraries must be manually installed by the user, which makes it impossible to link the binary in virtual mode, and, as you can see, there are problems with (pseudo) statically linked binary code.

For completeness, I first forgot to update rvm ( rvm get head ), which gave some other errors, but still needed the --disable-binary flag when I did this.

+7
Apr 22 '14 at 12:08
source share

If the recommended answer did not help, because you are already using a newer version of bundler. Try the solution that worked for me.

Delete all contents of the provider folder. Add a line to your gemfile

 gem 'json', '1.8.0' 

Then run - bundle update json .

There seems to be a problem with 1.8.1, so going back to 1.8.0 did the trick for me.

+7
Nov 04 '14 at 21:20
source share

bundle update json . Helped get through.

+4
Jul 31 '16 at 17:21
source share

For OS X, make sure you have coreutils

 $ brew install coreutils $ bundle 
+3
Jun 14 '16 at 7:13
source share

This seems to be a bug in the Bundler that does not recognize the standard stones installed with ruby ​​2.x. I still ran into the problem even with the latest version of the package (1.5.3).

One solution is to simply remove 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 that, the picker should not have problems finding the gem. Please note that I am using chruby. If you use any other ruby ​​manager, you will have to update your path accordingly.

+2
Feb 07 '14 at 19:59
source share

I missed the C headers solution to download it for Xcode, this is the best way.

 xcode-select --install 

Hope this helps.

+2
Apr 12 '16 at 11:23
source share

I installed the latest version of json:

 gem install json 

Then removed the json (1.8.1) line from Gemfile.lock and executed

 bundle install 

And then the Gemfile.lock file uses json (1.8.3) without erros

+2
May 02 '16 at 13:09
source share

Bundle was unable to install json -v '1.8.1', and uninstalling my Gemfile.lock and running package again solved this problem for me.

+2
Nov 11 '16 at 15:26
source share

Switching the ruby ​​version from 1.9 to 2.2 using rvm did the job for me

0
Jul 11 '16 at 19:14
source share

For me, some of the answers mentioned earlier were helpful in terms of understanding, but this did not help solve my problem.

So this is what I did to solve the problem.

  • Modified gemfile.lock for json (2.0.2) update (earlier it was 1.8.3)
  • Check the installed version of Bundler ( Bundler -v command). I have version 1.12.5 installed.
  • Install the package package version 1.11.2 (using gem install bundler -v '1.11.2' )
  • Then install the package
0
Sep 06 '16 at 17:13
source share

For macOS Sierra:

I ran into this error. When I used the linker ( v1.15.3 ) in a Rails project ( v4.2 ). The solution for me is gem uninstall bundler -v '1.15.3' and gem install bundler -v '1.14.6' .

0
Jul 28 '17 at 7:41
source share



All Articles