安装“gem”时发生错误,Bundler 无法继续。 Mac 操作系统 - 大苏尔

问题描述 投票:0回答:1

之前,当我升级到 Catalina 时,使用 nio4r gem 时,这个错误就发生在我身上,@dmitry Barskov 回答了它。在使用 json、oj 和 therubyracer 进行大 sur 升级后,现在发生了类似的问题(尝试使用 nio4r 的解决方案,但没有运气)。当我运行

gem list
时,我看到 gems 已安装,但捆绑安装失败。所以我尝试了bundle update json oj therubyracer。它适用于 json 和 oj,但对于 therubyracer,它会抛出错误。

therubyracer 错误 -->

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/me/.gem/gems/therubyracer-0.12.2/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210106-9670-edtaxk.rb extconf.rb --with-v8-dir\=/usr/local/opt/v8
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    --with-pthreadlib
    --without-pthreadlib
    --with-objclib
    --without-objclib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/Users/me/.gem/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version
(Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.

However, your system version of v8 could not be located.

Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed.

json 错误 -->

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210106-29155-126itgi.rb extconf.rb
creating Makefile

current directory: /Users/me/.gem/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/me/.gem/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c:861:25: error: use of undeclared identifier 'rb_cFixnum'
    } else if (klass == rb_cFixnum) {
                        ^
generator.c:863:25: error: use of undeclared identifier 'rb_cBignum'
    } else if (klass == rb_cBignum) {
                        ^
2 errors generated.
make: *** [generator.o] Error 1

make failed, exit code 2
*** LOCAL GEMS ***

bigdecimal (1.2.8)
bundler (1.17.3)
json (1.8.3)
libv8 (3.16.14.17)
oj (2.15.0)
rake (10.4.2)
ref (2.0.0)
therubyracer (0.12.3)

checking for v8.h... no
我知道这可能是一个问题,所以这就是我尝试修复它的方法,但没有成功->

brew install v8-315
gem uninstall -a libv8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix [email protected])
gem install libv8 -v '3.16.14.17' — —with-system-v8
gem uninstall -a therubyracer
bundle config build.libv8 --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-v8-dir=$(brew --prefix [email protected])

当我进行捆绑更新时,它陷入了解决依赖关系的困境......我让它运行了 12 个小时才放弃。 当我删除 gemfile.lock 并运行捆绑安装时,它再次陷入解决依赖关系的困境......。

我使用的是 ruby v 2.3.1 捆绑器版本 1.17.3

我注意到的一件事是路径

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
显示2.6.0,但我使用的是2.3.1(通过运行 rbenv local 和 ruby -v 确认)

如果需要任何其他信息,请告诉我。任何帮助将不胜感激。

ruby rubygems v8 macos-big-sur therubyracer
1个回答
0
投票

我最终删除了项目文件夹并克隆了一个新文件夹。删除了所有 gem,重新安装了 rbenv,就像 @taylorthurlow 指出的那样。

一切正常,捆绑安装是绿色的。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.