[RAILS] Gem :: Ext :: BuildError: ERROR: Failed to build gem native extension. Appears during gem install on debian distribution

background

When installing bundle with docker-compose, I was angry to install sassc and executed it, but the OS did not start, so I will share it.

Execution environment

debian 10.6 rails 5.2.4.3

Event

The server breaks after about 5 minutes with the following error

python


# gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    current directory: /usr/local/bundle/gems/sassc-2.4.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.4.0 -r
./siteconf20201026-6-pwczrb.rb extconf.rb
extconf failedCannot allocate memory - /usr/local/bin/ruby
Gem files will remain installed in /usr/local/bundle/gems/sassc-2.4.0 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.4.0/sassc-2.4.0/gem_make.out
An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
Make sure that `g @'`
succeeds before bundling.
In Gemfile:
  bootstrap was resolved to 4.5.2, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc

Cause

Not enough memory I had a contract for an instance type in the AWS free tier, and when I changed the memory from 1G to 2G, it passed smoothly.

How to add memory

I added more memory by changing the instance type. (I built a new OS) Launch an AWS instance → Select an Amazon machine image (Red Hat in my case) → Select 2GB of memory .... (Omitted below)

Recommended Posts

Gem :: Ext :: BuildError: ERROR: Failed to build gem native extension. Appears during gem install on debian distribution
[AWS] $ docker build. * Error * Gem :: Ext :: BuildError: ERROR: Failed to build gem native extension.