强制旧版本的依赖gem

时间:2015-04-09 14:45:19

标签: ruby-on-rails ruby heroku rubygems

我正在开发的应用程序突然停止部署到Heroku,错误:

remote:        Gem::InstallError: execjs requires Ruby version >= 2.0.0.                        
remote:        An error occurred while installing execjs (2.5.1), and Bundler cannot continue.  
remote:        Make sure that `gem install execjs -v '2.5.1'` succeeds before bundling.         
remote:  !                                                                                      
remote:  !     Failed to install gems via Bundler.                                              
remote:  !                                                                                      
remote:                                                                                         
remote:  !     Push rejected, failed to compile Ruby app                                        

Ruby 2.0对我来说不是一个可行的选择(我别无选择,只能在MS Windows上开发,而且上次我看过太多Ruby 2.0的东西不能用于Windows),但我认为我不需要execjs -v2.5.1。我没有在我的gemfile中明确地调用它,如果我运行gem dependency execjs --reverse-dependencies,我得到:

Gem execjs-1.4.0                            
  multi_json (~> 1.0)                       
  rake (>= 0, development)                  
  Used by                                   
    coffee-script-2.3.0 (execjs (>= 0))     
    coffee-script-2.2.0 (execjs (>= 0))     
    sprockets-2.12.3 (execjs (~> 1.0, develo
    sprockets-2.11.0 (execjs (~> 1.0, develo
    sprockets-2.1.3 (execjs (~> 1.0, develop
    uglifier-2.5.3 (execjs (>= 0.3.0))      
    uglifier-1.2.6 (execjs (>= 0.3.0))      

Gem execjs-2.2.1                            
  rake (>= 0, development)                  
  Used by                                   
    coffee-script-2.3.0 (execjs (>= 0))     
    coffee-script-2.2.0 (execjs (>= 0))     
    uglifier-2.5.3 (execjs (>= 0.3.0))      
    uglifier-1.2.6 (execjs (>= 0.3.0))      

Gem execjs-2.2.2                            
  rake (>= 0, development)                  
  Used by                                   
    coffee-script-2.3.0 (execjs (>= 0))     
    coffee-script-2.2.0 (execjs (>= 0))     
    uglifier-2.5.3 (execjs (>= 0.3.0))      
    uglifier-1.2.6 (execjs (>= 0.3.0))      

Gem execjs-2.3.0                            
  rake (>= 0, development)                  
  Used by                                   
    coffee-script-2.3.0 (execjs (>= 0))     
    coffee-script-2.2.0 (execjs (>= 0))     
    uglifier-2.5.3 (execjs (>= 0.3.0))      
    uglifier-1.2.6 (execjs (>= 0.3.0))      

Gem execjs-2.4.0                            
  rake (>= 0, development)                  
  Used by                                   
    coffee-script-2.3.0 (execjs (>= 0))     
    coffee-script-2.2.0 (execjs (>= 0))     
    uglifier-2.5.3 (execjs (>= 0.3.0))      
    uglifier-1.2.6 (execjs (>= 0.3.0))

看起来好像我不需要比v2.4.0更晚的东西(我正确地阅读了吗?)但是如何告诉我的宝石使用的是旧版本,而不是最新版本?

2 个答案:

答案 0 :(得分:3)

尝试在您的Gemfile中锁定您的execjs版本:

gem 'execjs', '2.4.0'

答案 1 :(得分:2)

您可以在Gemfile中指定gem版本,如下所示:

gem "haml-rails", "~> 0.3.4"

或(特定版本)

gem "haml-rails", "0.3.4"

有关详细信息,请单击此处:
Meaning of tilde-greater-than (~>) in version requirement?