【问题标题】:Ruby on Rails 4 in Windows 7: Bundle install using wrong therubyracer gemWindows 7 中的 Ruby on Rails 4:使用错误的 therubyracer gem 进行捆绑安装
【发布时间】:2016-05-22 14:01:12
【问题描述】:

我正在尝试在 Windows 7 64 位中为 Ruby on Rails 项目运行 bundle install,但由于 therubyracer gem,我无法执行此操作。我在 Ubuntu 中开发它,但我需要在 Windows 7 计算机上将其作为生产运行。

经过搜索,我发现我应该在这里使用这个 gem:https://github.com/eakmotion/therubyracer_for_windows/blob/master。它似乎已经在我的 gems 中安装了therubyracer-0.11.0beta1-x86-mingw32。我还按照gem install libv8 --version '3.11.8.17' on ruby (windows) 中的建议使用gem install libv8 -v '3.16.14.7' -- --with-system-v8 安装了libv8

但是,即使按照该 gem 的安装说明进行操作,bundle install 仍会尝试安装 therubyracer gem(版本 0.12.1)。所以,我的问题是:如何使用我手动安装的 therubyracer gem 运行 bundle install?

版本:ruby 2.1.5,rails 4.1.8,使用 Rails Installer http://www.railsinstaller.org/en安装

Gemfile 的相关行:

gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

如果我将"therubyracer" 换成"therubyracer_for_windows",当我尝试使用bundle install 时,我会收到一条错误消息Could not find gem 'therubyracer_for_windows (>= 0) ruby' in the gems available on this machine.

bundle install 的错误信息:

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

    current directory: C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ther
ubyracer-0.12.1/ext/v8
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20160211-944-u6p7vs.rb ext
conf.rb
checking for main() in -lpthread... no
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=C:/RailsInstaller/Ruby2.1.0/bin/ruby
        --with-pthreadlib
        --without-pthreadlib
        --enable-debug
        --disable-debug
        --with-v8-dir
        --without-v8-dir
        --with-v8-include
        --without-v8-include=${v8-dir}/include
        --with-v8-lib
        --without-v8-lib=${v8-dir}/lib
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/l
ocation.rb:50:in `configure': You have chosen to use the version of V8 found on
your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.7 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location

thanks,
The Mgmt

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.
7/lib/libv8.rb:7:in `configure_makefile'
        from extconf.rb:32:in `<main>'

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

  C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/t
herubyracer-0.12.1/mkmf.log

【问题讨论】:

    标签: ruby-on-rails windows ruby-on-rails-4 rubygems therubyracer


    【解决方案1】:

    尝试在 gemfile 中指定版本,例如:

    gem "therubyracer", "0.11.0beta1"
    

    我至少已经成功地让捆绑安装以这种方式完成。

    【讨论】:

    • 就我所记得的,我尝试这样做,但也许我使用了错误的 therubyracer 版本。只要有可能,我会再试一次。提前致谢!
    • @BrianHellekin 我在同事的 Windows 机器上遇到过这个问题,但即使在构建它之后,我在运行任何试图包含 V8 的引导程序代码时遇到了一些崩溃。最终我只是放弃并使用了一个虚拟机
    • 我又试了一次,没有成功。当我最后一次尝试时,我也放弃了,而是在运行 Ubuntu 或 CentOS 的虚拟机上取得了成功——甚至 Cygwin 都失败了......
    猜你喜欢
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多