【问题标题】:therubyracer error on heroku as "Failed to install gems via Bundler."heroku 上的 therubyracer 错误为“无法通过 Bundler 安装 gems”。
【发布时间】:2013-05-22 15:44:31
【问题描述】:

当我将我的应用程序推送到 heroku 时,它给了我以下错误

-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       You are trying to install in deployment mode after changing
       your Gemfile. Run `bundle install` elsewhere and add the
       updated Gemfile.lock to version control.
       You have added to the Gemfile:
       * therubyracer
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/Rails app

我删除了我的 Gemlock 文件并再次捆绑安装它,但仍然给我同样的错误。我还尝试了bundle install --without development:test 进行生产,它也给了我同样的错误我该怎么办。这是我的 Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.9'

gem 'carrierwave'
gem 'newrelic_rpm'

#gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS

#gem "twitter-bootstrap-rails"
gem 'will_paginate', '3.0.3'
#gem 'bootstrap-will_paginate', '0.0.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

#gem 'mysql2'
gem 'dynamic_form'
gem 'therubyracer', '0.10.2', :platforms => :ruby
gem 'devise'
gem 'hirb'

# Gems used for Facebook
gem 'facebook_oauth'
gem 'oauth','0.4.7'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'thin'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  #gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

【问题讨论】:

  • 我使用的是 ubuntu 12.04

标签: ruby-on-rails-3 rubygems therubyracer


【解决方案1】:

根据Heroku docs

如果您之前使用的是 therubyracer 或 therubyracer-heroku,则不再需要这些 gem,并且强烈建议不要,因为这些 gem 会占用大量内存。

作为 Ubuntu 的替代品,您可以安装 NodeJS:

sudo apt-get install nodejs

【讨论】:

    【解决方案2】:

    therubyracer gem 用于从 Ruby 内部评估 JavaScript(它将 JavaScript 解释器嵌入到 Ruby 中)。

    这个 gem 是必需的,如果你在 Ubuntu 中开发,因为 ubuntu 没有Javascript runtime

    Heroku 并非如此。

    因此,只需将therubyracer gem 的行保留在development 组下的Gemfile 中,如下所示:

    group :development do
      gem 'therubyracer', '0.10.2', :platforms => :ruby
    end
    

    【讨论】:

      【解决方案3】:

      尝试运行bundle install,而不是将更改推送到远程仓库。

      此外,如果您使用 ruby​​racer 进行资产编译,您可以在本地预编译资产并阅读以下文档: https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally https://devcenter.heroku.com/articles/rails-asset-pipeline#therubyracer

      【讨论】:

        猜你喜欢
        • 2012-10-10
        • 1970-01-01
        • 1970-01-01
        • 2015-09-23
        • 2019-01-07
        • 2021-08-27
        • 1970-01-01
        • 1970-01-01
        • 2012-03-26
        相关资源
        最近更新 更多