简体   繁体   English

为Ruby on Rails应用运行'bundle install'命令时出错

[英]Error running 'bundle install' command for Ruby on rails app

Here's the snapshot from the terminal. 这是终端的快照。 First I wanted to run rake db:create . 首先,我想运行rake db:create Had errors. 发生错误。 StackOverflow suggested $gem install bundler , $bundle install , $bundle exec rake db:create . StackOverflow建议$gem install bundler$bundle install$bundle exec rake db:create

bundle install command throws error. bundle install命令将引发错误。

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.42
Using activesupport 4.0.2
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.2
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.2
Using activemodel 4.0.2
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.2
Using bundler 1.7.4
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.0.2
Using coffee-rails 4.0.1
Using hike 1.2.3
Using jbuilder 1.5.3
Using jquery-rails 3.1.2

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

    /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file       -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'


Gem files will remain installed in /tmp/bundler20141106-4967-2t867n/json-1.8.1/gems        /json-1.8.1 for inspection.
Results logged to /tmp/bundler20141106-4967-2t867n/json-1.8.1/gems/json-1.8.1/ext    /json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

Edit: What I did next: 编辑:我下一步做什么:

$sudo gem install json -v '1.8.1'
Building native extensions.  This could take a while...
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf     (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'

Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

srikaanth@ubuntu:~/rails_app/books$ ruby -version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)

Gems sometimes build against local libraries, so they need to be available. 宝石有时是针对本地图书馆建造的,因此必须可用。

It looks like your system has a very old version of Ruby (1.9.1), yet you're running a Rails 4 environment. 您的系统似乎具有非常旧的Ruby(1.9.1)版本,但您正在运行Rails 4环境。 Install Ruby 2.x (1.9.3 might also work). 安装Ruby 2.x(1.9.3也可以)。 If you're running on Linux you probably have the libraries you need installed; 如果您在Linux上运行,则可能已安装了所需的库; if on OS XI suggest using X Code, home brew and a ruby version manager like RVM or rbenv. 如果在OS XI上建议使用X代码,家用酿造软件和红宝石版本管理器(如RVM或rbenv)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM