简体   繁体   中英

An error occurred while installing nio4r (1.2.1), and Bundler cannot continue

Hi I'm working on putting my website to digital ocean. But when in the process when i Bundle install i get this error

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.

I'm using Putty.exe to configure it following the tutorial https://www.digitalocean.com/community/tutorials/how-to-use-the-ruby-on-rails-one-click-application-on-digitalocean

I'm using Ruby ruby 2.2.4p230 Rails 5.0.0.1

Not sure if this help. When i using Putty.exe to configure my website the tutorial said If your Gemfile specifies a version of Ruby that is different from the one installed on the system, you may install it using RVM. So I tried:

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

But I get the error ruby-2.2.4-p230 is not installed. And it can't installed because the system cannot find the specific version. So I use

 rvm use ruby-2.2.4
sudo apt-get install build-essential

为我工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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