安装nio4r(1.2.1)时发生错误,Bundler无法继续

时间:2016-10-01 07:29:34

标签: ruby-on-rails ruby digital-ocean

您好,我正致力于将我的网站投放到数字海洋。但是当我在捆绑安装的过程中,我得到了这个错误

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20161001-6508-ukh5t9.rb extconf.rb --with-cflags=-std=c99
checking for unistd.h... *** 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=/usr/local/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
        from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
        from extconf.rb:3:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.4/gems/nio4r-1.2.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/nio4r-1.2.1/gem_make.out

An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.

我使用Putty.exe按照教程https://www.digitalocean.com/community/tutorials/how-to-use-the-ruby-on-rails-one-click-application-on-digitalocean

配置它

我使用Ruby ruby​​ 2.2.4p230 Rails 5.0.0.1

不确定是否有这个帮助。当我使用Putty.exe配置我的网站时,教程说如果你的Gemfile指定的Ruby版本与系统上安装的版本不同,你可以使用RVM安装它。所以我试过了:

rvm install 2.2.4
rvm use ruby-2.2.4-p230 --default

但我收到错误ruby-2.2.4-p230未安装。并且它无法安装,因为系统无法找到特定版本。所以我用

 rvm use ruby-2.2.4

1 个答案:

答案 0 :(得分:0)

sudo apt-get install build-essential

为我工作