1

我從生產中複製了該應用程序,並進行了bundle install以安裝生產版本中而不是本地機器上的所有缺失gem。無法構建不同版本的gem本機擴展ruby racer gem

Gem.lock文件具有rubyracer版本'0.10.1'。所以,當它試圖使用捆綁安裝安裝此版本時出現以下錯誤。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb                                                   
*** extconf.rb failed ***                                                              
Could not create Makefile due to some reason, probably lack of                                                     
necessary libraries and/or headers. Check the mkmf.log file for more                                                   
details. You may need configuration options.                                                         

Provided configuration options:                                                             
     --with-opt-dir                                                               
     --without-opt-dir                                                              
     --with-opt-include                                                              
     --without-opt-include=${opt-dir}/include                                                        
     --with-opt-lib                                                               
     --without-opt-lib=${opt-dir}/lib                                                          
     --with-make-prog                                                              
     --without-make-prog                                                              
     --srcdir=.                                                                
     --curdir                                                                
     --ruby=/home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby                                                    
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)                                              


Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1 for inspection.                                        
Results logged to /home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1/ext/v8/gem_make.out  

由於出現此錯誤,我無法在本地計算機的生產版本代碼上運行腳手架命令。請幫助我。

我們可以編輯gemfile.lock以刪除「therubyracer(0.10.1)」,然後運行命令generate scaffold,然後在使用生成腳手架後放回更改嗎?

編輯:

*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
     --with-opt-dir 
     --without-opt-dir 
     --with-opt-include 
     --without-opt-include=${opt-dir}/include 
     --with-opt-lib 
     --without-opt-lib=${opt-dir}/lib 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=/home/vsadhu/.rvm/rubies/ruby-1.9.3-p392/bin/ruby 
extconf.rb:14:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError) 
+0

假設'紅寶石racer'是在生產組試圖'捆綁安裝--without production' – j03w

+0

@ j03w ..真但是當我導航到我的生產服務器並運行生成腳手架時,它不會運行,原因是gemfile.lock包含0.10.1版本的ruby racer。並說失蹤 – user2569524

+0

你當地的環境是什麼?你有沒有檢查'/ home/user/.rvm/gems/ruby​​-1.9.3 -p392/gems/therubyracer-0.10.1/ext/v8/gem_make.out'並查看缺少的內容? – j03w

回答

1

在響應以下報價:

我們可以編輯Gemfile.lock的刪除 「therubyracer(0.10.1)」

無我們不可以。依賴於你對你有怎樣OS能夠做到以下幾點:

$gem uninstall libv8 
$gem install therubyracer 

我有我最近做了一個Rails應用程序,我也被走行軌3.2.14,並執行以下操作:

group :assets do 
    gem 'therubyracer', :require => 'v8' 
    gem 'less-rails' 
    gem 'coffee-rails', '~> 3.2.1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

如果在將此資產塊添加到您的gem文件之前,請使用第二種方法。 刪除Gemfile.lock,然後將資產塊添加到Gemfile中,保存和運行bundle update

+0

但卸載libv8會導致任何其他問題?基本上它用於什麼? – user2569524

+0

@ user2569524總之看看這個 - https://github.com/cowboyd/libv8 :)。 Quote:''一個用於分發源代碼和二進制形式的v8運行時庫和頭文件的gem「,我相信它不應該。因此,請嘗試卸載libv8,然後gem install therubyracer並執行您所嘗試的任何內容。如果這不起作用,請複製我提供給您的'asset'塊,然後**刪除** gemfile.lock'並運行'bundle update' – David

+0

肯定會試試這個,並會讓你知道我得到了什麼。非常感謝 :) – user2569524

相關問題