窗户上的 therubyracer gem

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6356450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 01:24:43  来源:igfitidea点击:

therubyracer gem on windows

ruby-on-railsrubygemsbundlerdevkit

提问by Nik So

I've been peacefully developing on Windows without adding any gems for a few weeks now and today I decided to do a bundle update, but I cannot get through this gem called therubyracer. I have the devkit installed and it is working according to the documentation's verification procedure.

几个星期以来,我一直在 Windows 上进行和平开发,没有添加任何 gem,今天我决定进行一次捆绑更新,但我无法通过这个名为 therubyracer 的 gem。我已经安装了 devkit,它正在根据文档的验证程序工作。

My question is: is there a way to install this gem at all on windows?

我的问题是:有没有办法在 Windows 上安装这个 gem?

And is this gem going to be required by rails 3.1 and this is why now that I do a bundle update it is being 'slipped' into the rails 3.0.8 as a gesture of early kick start for future 3.1 migration?

并且这个 gem 是否会被 rails 3.1 所需要,这就是为什么现在我做了一个包更新,它被“滑入”到 rails 3.0.8 中,作为未来 3.1 迁移的早期启动手势?

EDIT including Gemfile and Gemfile.lock

编辑包括 Gemfile 和 Gemfile.lock

# Gemfile
# source 'http://rubygems.org'
source :rubygems

gem 'rails'
gem 'rake', '0.8.7'
gem 'youtube_it'
gem 'panda'
gem "nifty-generators"
# gem "mongoid", "2.0.0.rc.7"
gem "mongoid"
gem "mongoid-eager-loading"
# gem 'mongoid_search'
gem "bson_ext", ">1.1.5"
gem 'devise'
gem 'cancan'
gem 'hirb'
# gem 'heroku'
gem 'rest-client'
gem 'less' # needs the more plugin
# gem 'hash_extension'
gem 'aws-s3', :require => 'aws/s3' # s3.rb
gem 'jquery-rails', ">= 0.2.7" # rails g jquery:install
# gem 'mongrel', ">= 1.2.0.pre2"
gem 'delayed_job'
gem 'delayed_job_mongoid'
gem 'kaminari'



# Gemfile.lock
GEM
  remote: http://rubygems.org/
  specs:
    abstract (1.0.0)
    actionmailer (3.0.8)
      actionpack (= 3.0.8)
      mail (~> 2.2.19)
    actionpack (3.0.8)
      activemodel (= 3.0.8)
      activesupport (= 3.0.8)
      builder (~> 2.1.2)
      erubis (~> 2.6.6)
      i18n (~> 0.5.0)
      rack (~> 1.2.1)
      rack-mount (~> 0.6.14)
      rack-test (~> 0.5.7)
      tzinfo (~> 0.3.23)
    activemodel (3.0.8)
      activesupport (= 3.0.8)
      builder (~> 2.1.2)
      i18n (~> 0.5.0)
    activerecord (3.0.8)
      activemodel (= 3.0.8)
      activesupport (= 3.0.8)
      arel (~> 2.0.10)
      tzinfo (~> 0.3.23)
    activeresource (3.0.8)
      activemodel (= 3.0.8)
      activesupport (= 3.0.8)
    activesupport (3.0.8)
    arel (2.0.10)
    aws-s3 (0.6.2)
      builder
      mime-types
      xml-simple
    bcrypt-ruby (2.1.4-x86-mingw32)
    bson (1.3.1)
    bson_ext (1.3.1)
    builder (2.1.2)
    cancan (1.6.5)
    daemons (1.1.3)
    delayed_job (2.1.4)
      activesupport (~> 3.0)
      daemons
    delayed_job_mongoid (1.0.2)
      delayed_job (~> 2.1.1)
      mongoid (~> 2.0.0.rc)
    devise (1.3.4)
      bcrypt-ruby (~> 2.1.2)
      orm_adapter (~> 0.0.3)
      warden (~> 1.0.3)
    erubis (2.6.6)
      abstract (>= 1.0.0)
    hirb (0.4.5)
    i18n (0.5.0)
    jquery-rails (1.0.10)
      railties (~> 3.0)
      thor (~> 0.14)
    json (1.5.2)
    kaminari (0.12.4)
      rails (>= 3.0.0)
    less (1.2.21)
      mutter (>= 0.4.2)
      treetop (>= 1.4.2)
    mail (2.2.19)
      activesupport (>= 2.3.6)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.16)
    mongo (1.3.1)
      bson (>= 1.3.1)
    mongoid (2.0.2)
      activemodel (~> 3.0)
      mongo (~> 1.3)
      tzinfo (~> 0.3.22)
    mongoid-eager-loading (0.3.1)
    mutter (0.5.3)
    nifty-generators (0.4.6)
    oauth (0.4.4)
    orm_adapter (0.0.5)
    panda (1.4.2)
      json
      rest-client
      ruby-hmac (>= 0.3.2)
    polyglot (0.3.1)
    rack (1.2.3)
    rack-mount (0.6.14)
      rack (>= 1.0.0)
    rack-test (0.5.7)
      rack (>= 1.0)
    rails (3.0.8)
      actionmailer (= 3.0.8)
      actionpack (= 3.0.8)
      activerecord (= 3.0.8)
      activeresource (= 3.0.8)
      activesupport (= 3.0.8)
      bundler (~> 1.0)
      railties (= 3.0.8)
    railties (3.0.8)
      actionpack (= 3.0.8)
      activesupport (= 3.0.8)
      rake (>= 0.8.7)
      thor (~> 0.14.4)
    rake (0.8.7)
    rest-client (1.6.1)
      mime-types (>= 1.16)
    ruby-hmac (0.4.0)
    thor (0.14.6)
    treetop (1.4.9)
      polyglot (>= 0.3.1)
    tzinfo (0.3.28)
    warden (1.0.4)
      rack (>= 1.0)
    xml-simple (1.0.16)
    youtube_it (1.4.2)
      builder
      oauth (>= 0.4.4)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  aws-s3
  bson_ext (> 1.1.5)
  cancan
  delayed_job
  delayed_job_mongoid
  devise
  hirb
  jquery-rails (>= 0.2.7)
  kaminari
  less
  mongoid
  mongoid-eager-loading
  nifty-generators
  panda
  rails
  rake (= 0.8.7)
  rest-client
  youtube_it

回答by Charles Lowell

No, there is no way that I know of to currently install this gem on Windows. The problem is that there is currently no pre-compiled version of the libv8 gem for Windows, and the source version is only compatible with *nix. It does not necessarily have to be that way, it just requires somebody taking the time to make the compile work for Windows. https://github.com/cowboyd/libv8

不,据我所知,目前无法在 Windows 上安装此 gem。问题是目前没有预编译版本的libv8 gem for Windows,源码版本只兼容*nix。它不一定是那样,它只需要有人花时间使编译适用于 Windows。https://github.com/cowboyd/libv8

That said, Windows should come with a JScript, the Microsoft JavaScript runtime, which Rails (via execjs) will automatically detect and use, so you should be able to just remove your dependency on therubyracer.

也就是说,Windows 应该附带一个 JScript,即 Microsoft JavaScript 运行时,Rails(通过execjs)将自动检测和使用它,因此您应该能够删除对 therubyracer 的依赖。

As the maintainer of that gem, this would of course make me sad, but it should get you on your way.

作为那个 gem 的维护者,这当然会让我感到难过,但它应该会让你继续前进。

回答by Dominic Sayers

This is essentially what Nik has done, I believe:

这基本上就是 Nik 所做的,我相信:

In your Gemfile isolate the TheRubyRacer gem to the production environment like this:

在您的 Gemfile 中,将 TheRubyRacer gem 隔离到生产环境中,如下所示:

group :production do
  gem 'therubyracer-heroku', :platform => :ruby
end

In your development environment, instead of a plain bundle installdo

在你的开发环境中,而不是简单的bundle install

bundle install --without production

or, as Nik suggests, bundle install development. When you deploy to Heroku it will install the gem because it is the production environment.

或者,正如 Nik 所建议的那样,bundle install development. 当您部署到 Heroku 时,它将安装 gem,因为它是生产环境。

Rails gurus: please suggest edits to make this less sucky.

Rails 大师:请提出修改建议,使这不那么糟糕。

回答by Hiran

The reason for all of these problems is the therubyracer-0.11.0beta1-x86-mingw32.gem and the v8.dll.

所有这些问题的原因是 therubyracer-0.11.0beta1-x86-mingw32.gem 和 v8.dll。

I have complied the necessary dlls and gem files and upload them to github.

我已经编译了必要的 dll 和 gem 文件并将它们上传到 github。

download the package and follow the instructions.

下载软件包并按照说明进行操作。

https://github.com/eakmotion/therubyracer_for_windows

https://github.com/eakmotion/therubyracer_for_windows

回答by Alex

There is build for windows. It can be manually downloaded and installed by gem install therubyracer-0.11.0beta1-x86-mingw32.gem.

适用于 windows 的构建。它可以通过 手动下载和安装gem install therubyracer-0.11.0beta1-x86-mingw32.gem

回答by jdc

To answer part of your question about Rails 3.1, here's the deal...

要回答有关 Rails 3.1 的部分问题,这里是交易...

Rails 3.1 currently uses a gem that requires a javascript runtime to be installed on the machine. On Mac you typically don't have to worry about this since it already has one, but Linux (and I think Windows too) you need to install one. So, therubyracer, or sometimes node or nodejs, are sometimes installed since they provide that.

Rails 3.1 目前使用的 gem 需要在机器上安装 javascript 运行时。在 Mac 上,您通常不必担心这一点,因为它已经有了,但是 Linux(我认为 Windows 也是如此)您需要安装一个。因此,有时会安装 therubyracer,或者有时是 node 或 nodejs,因为它们提供了这些。

However, one of the main Rails guys said they plan to fix that dependency before the final Rails 3.1 release, so hopefully that'll happen and the dependency will be gone.

然而,Rails 的一位主要人员表示,他们计划在最终的 Rails 3.1 发布之前修复该依赖项,因此希望这会发生并且依赖项将消失。