无法构建 gem 本机扩展(Windows 10)来安装 mini_racer 和 libv8-node

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

尝试使用

bundle exec jekyll serve
使用jekyll生成网站并被返回:

在本地安装的 gem 中找不到 gem 'mini_racer'。运行bundle install来安装缺少的gems。

所以我做到了

bundle install

并收到此错误:

Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Installing libv8-node 18.16.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-node-18.16.0.0/ext/libv8-node
D:/Ruby32-x64/bin/ruby.exe extconf.rb
creating Makefile
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-node-18.16.0.0/ext/libv8-node/builder.rb:12:in
`build_libv8!': failed to download node 18.16.0 (Libv8::Node::BuilderError)
from
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-node-18.16.0.0/ext/libv8-node/location.rb:30:in
`install!'
        from extconf.rb:15:in `<main>'
==== in
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-node-18.16.0.0/ext/libv8-node
==== running
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-node-18.16.0.0/libexec/download-node

extconf failed, exit code 1

An error occurred while installing libv8-node (18.16.0.0), and Bundler cannot
continue.

In Gemfile:
  mini_racer was resolved to 0.8.0, which depends on
    libv8-node

我也尝试过

gem install libv8
并被退回:

Fetching libv8-8.4.255.0.gem
Temporarily enhancing PATH for MSYS/MINGW...
WARNING:  libv8-8.4.255.0 ships with a dangling symlink named vendor/depot_tools/cbuildbot pointing to missing vendor/depot_tools/cros file. Ignoring
WARNING:  libv8-8.4.255.0 ships with a dangling symlink named vendor/depot_tools/chrome_set_ver pointing to missing vendor/depot_tools/cros file. Ignoring
WARNING:  libv8-8.4.255.0 ships with a dangling symlink named vendor/depot_tools/cros_sdk pointing to missing vendor/depot_tools/cros file. Ignoring
Building native extensions. This could take a while...
ERROR:  Error installing libv8:
        ERROR: Failed to build gem native extension.

    current directory: D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-8.4.255.0/ext/libv8
D:/Ruby32-x64/bin/ruby.exe extconf.rb
creating Makefile
The system cannot find the path specified.

D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-8.4.255.0/ext/libv8/builder.rb:57:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError)
        from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-8.4.255.0/ext/libv8/builder.rb:39:in `build_libv8!'
        from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-8.4.255.0/ext/libv8/location.rb:24:in `install!'
        from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/libv8-8.4.255.0 for inspection.
Results logged to D:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/libv8-8.4.255.0/gem_make.out

我也尝试过

gem update
,这表明我的gem已更新。也做了
winget install ruby-dev
,它刚刚返回:

未找到符合输入条件的包。

ruby rubygems jekyll bundle libv8
1个回答
0
投票

我也遇到了同样的问题,我老板选择的模板需要安装“mini_racer”,但我不知道如何解决。如果您知道答案,请随时通知我。谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.