Bundle install: ERROR: Failed to build gem native extension. nio4r gem

前端 未结 7 492
刺人心
刺人心 2021-02-02 15:04

I\'m currently working on a project using:

  • rvm 1.26.11
  • ruby 2.2.1p85

I tried to run bundle install but keep getting the follow

相关标签:
7条回答
  • 2021-02-02 15:29

    Works fine with macOS Sierra (10.12.2) after running the following command:

    xcode-select --install
    

    Before i had:

    An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
    
    0 讨论(0)
  • 2021-02-02 15:32

    If you are working on Mac OSX above version 10.11.x, the following approach worked for me:

    gem install nio4r -v '1.1.0' -- with-cflags="-std=c99"
    
    0 讨论(0)
  • 2021-02-02 15:41

    Setting the bundle config didn't work for me...

    If you've recently updated Xcode, make sure to actually run the application and accept the terms of service.

    In my bundle error, I was getting You have to install development tools first.

    0 讨论(0)
  • 2021-02-02 15:48
    bundle config build.nio4r --with-cflags="-std=c99"
    bundle install
    

    works for me

    0 讨论(0)
  • 2021-02-02 15:52

    I solved it with:

    sudo apt-get install libmysqlclient-dev
    sudo apt-get install libpq-dev
    sudo apt-get install libsqlite3-dev
    sudo apt-get install libev-dev
    rvm use 2.0.0
    Reboot pc
    

    If I run rails -v shows me:

    • Rails 3.2.17

    And now I can make Bundle install

    I think the rails version was in conflict. I don't know why, maybe anyone can explain me.

    0 讨论(0)
  • 2021-02-02 15:53

    Update to version 1.0.4 if you're using Ruby 2.2.1

    0 讨论(0)
提交回复
热议问题