无法构建不同版本的gem本机扩展ruby racer gem [英] Failed to build gem native extension ruby racer gem of different version

查看:102
本文介绍了无法构建不同版本的gem本机扩展ruby racer gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从生产中复制了该应用程序,并进行了捆绑安装,以安装生产版本中所有缺少的gem,而不是安装在本地机器上。

Gem.lock文件具有rubyracer版本'0.10.1'。因此,当它试图安装此版本使用捆绑安装以下错误出现。

  Gem :: Installer :: ExtensionBuildError:错误:失败建立宝石原生扩展。 

/home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必要的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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:在<< main>':未定义的方法`include_path'为Libv8:Module(NoMethodError)


Gem文件将保留安装在/home/user/.rvm/gems/ruby-1.9.3- p392 / gems / therubyracer-0.10.1进行检查。
记录到/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,然后在使用generate脚手架?



编辑:

  *** extconf.rb失败*** 
由于某种原因无法创建Makefile,可能缺少
必需的库和/或标题。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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:在<< main>':未定义的方法`include_path'为Libv8:Module(NoMethodError)


解决方案<我们可以通过编辑gemfile.lock来移除therubyracer(0.10.1),


不,我们做不到。取决于你所在的操作系统,你可以执行以下操作:

  $ gem uninstall libv8 
$ gem install therubyracer

我有一个最近做过的Rails应用程序,我也运行Rails 3.2.14并具有以下功能:

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

#请参阅https://github.com/sstephenson/execjs#readme了解更多受支持的运行时间
#gem'therubyracer',:platforms => :ruby

gem'uglifier','> = 1.0.3'
end

在将此资产块添加到您的gem文件之前,您应该使用第二种方法。 删除您的 Gemfile.lock ,然后将资产块添加到Gemfile中,保存并运行 bundle update


I copied the application from production and did bundle install to install all the missing gems that are in production version and not on my local machine.

Gem.lock file has the rubyracer version '0.10.1'. So when it tried to install this version using bundle install following error appeared.

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      

I am not able to run the scaffolding commands on my production version of code from my local machine because of this error . Please help me out.

Can we edit the gemfile.lock to remove "therubyracer (0.10.1)" and then run the command generate scaffold and then place back the changes after my use of generate scaffold ?

EDIT :

 *** 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)

解决方案

In response to the following quote:

Can we edit the gemfile.lock to remove "therubyracer (0.10.1)"

No we cannot. Dependent on what OS you are on you can do the following:

$gem uninstall libv8 
$gem install therubyracer

I have a rails application that I recently did and I too was running Rails 3.2.14 and had the following:

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

Should you go with this second method please before you add this asset block to your gemfile. Delete your Gemfile.lock and then add the asset block to the Gemfile, save it and run bundle update

这篇关于无法构建不同版本的gem本机扩展ruby racer gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆