Unable to install shopify CLI - ERROR: Failed to build gem native extension

Unable to install shopify CLI - ERROR: Failed to build gem native extension

我正在使用 Zorin OS-16.01(基于 Ubuntu 20.04.2 LTS) 我试图安装 Shopify CLI。 我到目前为止-

sudo apt-get install ruby-full
sudo apt-get install ruby-dev

在这些之后,我尝试获取ruby版本-

ruby -v

我明白了-

ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

然后我尝试使用此命令安装 shopify cli -

sudo gem install shopify-cli

但是,我遇到了一个错误。这是完整的错误日志。

Building native extensions. This could take a while...
ERROR:  Error installing shopify-cli:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20220526-14302-svnr0c.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)2.7
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib
    --enable-system-libffi
    --disable-system-libffi
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
    --with-ffi-dir
    --without-ffi-dir
    --with-ffi-include
    --without-ffi-include=${ffi-dir}/include
    --with-ffi-lib
    --without-ffi-lib=${ffi-dir}/lib
/usr/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.7.0/mkmf.rb:613:in `try_cpp'
    from /usr/lib/ruby/2.7.0/mkmf.rb:1124:in `block in have_header'
    from /usr/lib/ruby/2.7.0/mkmf.rb:971:in `block in checking_for'
    from /usr/lib/ruby/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /usr/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/lib/ruby/2.7.0/mkmf.rb:361:in `block in postpone'
    from /usr/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/lib/ruby/2.7.0/mkmf.rb:357:in `postpone'
    from /usr/lib/ruby/2.7.0/mkmf.rb:970:in `checking_for'
    from /usr/lib/ruby/2.7.0/mkmf.rb:1123:in `have_header'
    from extconf.rb:10:in `system_libffi_usable?'
    from extconf.rb:42:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.7.0/gems/ffi-1.15.5 for inspection.

尝试安装这个

sudo apt install build-essential
sudo apt install libffi-dev