CentOS 7 安装ror出现的问题

2022-12-28 14:40:26 浏览数 (1)

  1. bundle install 执行时出现错误:
代码语言:javascript复制
$ bundle install
...
...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r
./siteconf20200902-61293-x9nl2q.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
make: g  :命令未找到
make: *** [ast.o] 错误 127

make failed, exit code 2

Gem files will remain installed in
/usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0 for inspection.
Results logged to
/usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sassc-2.4.0/gem_make.out

An error occurred while installing sassc (2.4.0), and Bundler cannot
continue.
Make sure that `gem install sassc -v '2.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  sass-rails was resolved to 6.0.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc

看提示,需要执行 gem install sassc -v '2.4.0' --source 'https://rubygems.org/'

  1. gem install sassc -v '2.4.0' --source 'https://rubygems.org/'

执行时出现错误:

代码语言:javascript复制
$ gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing sassc:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20200902-61353-1tfcwms.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
make: g  :命令未找到
make: *** [ast.o] 错误 127

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sassc-2.4.0/gem_make.out

解决方法:sudo yum group install "Development Tools" 该命令安装了一堆新的软件包,包括gcc,g 和make

再次执行:

代码语言:javascript复制
$ gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed sassc-2.4.0
Parsing documentation for sassc-2.4.0
Installing ri documentation for sassc-2.4.0
Done installing documentation for sassc after 0 seconds
1 gem installed

通过!

  1. bundle install时提示sqlite有点问题,于是执行gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'
代码语言:javascript复制
$ gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sqlite3-1.4.2/ext/sqlite3
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20200902-92796-gu5dhy.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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/local/bin/$(RUBY_BASE_NAME)
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-config
    --without-sqlite3-config
    --with-pkg-config
    --without-pkg-config
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib

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

  /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/sqlite3-1.4.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sqlite3-1.4.2/gem_make.out

看提示,sudo yum install sqlite-devel 安装后,重新执行命令,解决。

0 人点赞