强制使用旧版本的依赖gem



我正在开发的应用程序突然停止部署到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之后的任何东西(我读对了吗?)但我如何告诉我的gems使用旧版本,而不是最新版本?

尝试将execjs版本锁定在Gemfile:中

gem 'execjs', '2.4.0'

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

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

或(特定版本)

gem "haml-rails", "0.3.4"

有关详细信息,请单击此处:
版本要求中波浪号大于(~>)的含义?

相关内容

  • 没有找到相关文章

最新更新