宝石安装libv8 - 版本'3.11.8.17'在ruby(windows)上

use*_*042 43 ruby-on-rails libv8

问题如下.

Error installing libv8:
ERROR: Failed to build gem native extension.

    D:/Ruby193/bin/ruby.exe extconf.rb
    creating Makefile
    The system can not find the specified path

        D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:49:in'setup_python!':libv8 requires python 2 to be installed in order to build,but it is currently not available (RuntimeError)
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:35:in 'block in build_libv8!'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'chdir'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'build_libv8!'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'install!'
             from extconf.rb:7: in '<main>'
I have installed the python27 and add the path.

python --version
Python 2.7.4
Run Code Online (Sandbox Code Playgroud)

然后我检查代码如下.

 def setup_python!
      # If python v2 cannot be found in PATH,
      # create a symbolic link to python2 the current directory and put it
      # at the head of PATH. That way all commands that inherit this environment
      # will use ./python -> python2
      if python_version !~ /^2/
        unless system 'which python2 2>&1 > /dev/null'
          fail "libv8 requires python 2 to be installed in order to build, but it is currently #{python_version}"
        end
        `ln -fs #{`which python2`.chomp} python`
        ENV['PATH'] = "#{File.expand_path '.'}:#{ENV['PATH']}"
      end
    end
Run Code Online (Sandbox Code Playgroud)

我试图将Linux命令行安装到Windows,以便'ln -fs'应该正常工作.但问题仍然无法解决.

Per*_*ack 162

试试这个:

gem install libv8 -v '3.11.8.17' -- --with-system-v8
Run Code Online (Sandbox Code Playgroud)

这个错误很痛苦,直到我运行上面的命令:)

  • 我不得不将版本号更改为"3.16.14.3"以使其正常工作.希望它可以帮助某人. (15认同)
  • 这个命令成功,但`bundle install`仍然失败. (5认同)
  • 你刚刚给了我很多麻烦.荣誉. (3认同)

Vie*_*ngh 11

尝试使用https://github.com/eakmotion/therubyracer_for_windows.我使用这个解决方案在我的Windows机器上解决了同样的问题.


Rot*_*ots 0

我可能读错了,但我认为问题出在这一行:

unless system 'which python2 2>&1 > /dev/null'
Run Code Online (Sandbox Code Playgroud)

它正在寻找python2实际上 python 的命令是简单的python

也许尝试别名pythonpython2.