title: Cannot install json gem
body: <p>I've had this problem several times and was able to get this fixed by running <code>bundle update</code>, but now I cannot get it working at all. I haven't touched my rails app in about 3 weeks and now I come back and have this issue.</p>
  
  <p>Here's the error that I'm getting:</p>
  
  <pre><code>[root:acd9066b01f9:~/inspinia]# bundle update json                                                                                                                                                                                                         7:10PM/04.22
  Fetching gem metadata from https://rubygems.org/.............
  Fetching gem metadata from https://rubygems.org/.
  Resolving dependencies...
  Using rake 10.4.2
  Using i18n 0.7.0
  Fetching json 1.8.6 (was 1.8.3)
  Installing json 1.8.6 (was 1.8.3) with native extensions
  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
  current directory:
  /usr/local/rvm/gems/ruby-2.5.1/gems/json-1.8.6/ext/json/ext/generator
  /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -r ./siteconf20190422-4608-t99jp9.rb
  extconf.rb
  Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -r
  ./siteconf20190422-4608-t99jp9.rb extconf.rb 2&gt;&amp;1
  
  Gem files will remain installed in
  /usr/local/rvm/gems/ruby-2.5.1/gems/json-1.8.6 for inspection.
  Results logged to
  /usr/local/rvm/gems/ruby-2.5.1/extensions/x86_64-linux/2.5.0/json-1.8.6/gem_make.out
  
  An error occurred while installing json (1.8.6), and Bundler cannot
  continue.
  Make sure that `gem install json -v '1.8.6' --source 'https://rubygems.org/'`
  succeeds before bundling.
  
  In Gemfile:
    rails was resolved to 4.2.3, which depends on
      actionmailer was resolved to 4.2.3, which depends on
        actionpack was resolved to 4.2.3, which depends on
          actionview was resolved to 4.2.3, which depends on
            rails-dom-testing was resolved to 1.0.7, which depends on
              rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
                activesupport was resolved to 4.2.3, which depends on
                  json
  </code></pre>
  
  <p>So as shown above, I can't run <code>bundle update</code>. I've tried adding other versions of Json into the Gemfile, but 1.8.0, 1.8.1 both gave me the same exact error.</p>
  
  <p>I have tried to install other versions of bundler as well:</p>
  
  <pre><code>[root:acd9066b01f9:~/inspinia]# gem install bundler -v '= 1.5.1'                                                                                                                                                                                           7:10PM/04.22
  Successfully installed bundler-1.5.1           
  Parsing documentation for bundler-1.5.1                 
  Done installing documentation for bundler after 0 seconds
  1 gem installed    
  </code></pre>
  
  <p>Which doesn't help, as I run into the exact same problem.</p>
  
  <p>I've also tried some other suggestions mentioned in other posts, including <code>libgmp-dev</code>:</p>
  
  <pre><code>[root:acd9066b01f9:~/inspinia]# apt-get install libgmp-dev                                                                                                                                                                                                 7:12PM/04.22
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  libgmp-dev is already the newest version (2:6.1.2+dfsg-2).
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  </code></pre>
  
  <p>Any thoughts would be greatly appreciated. This seems like a repetitive issue that I can never get away from for whatever reason.</p>