Why do I get a bcrypt-ruby gem install error?

后端 未结 10 464
面向向阳花
面向向阳花 2020-12-06 09:07

Getting an error when trying to install the gem devise, the installation is stopping on the gem bcrypt-ruby:

$ gem install bcrypt-ruby
Error installing bcry         


        
相关标签:
10条回答
  • 2020-12-06 09:44

    I'm using RVM & I kept having this issue whenever installing gems with native extensions (bcrypt-ruby, bson-ext, json, eventmachine, nokogiri, linecache19, etc.)

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

    Only way I could finally get things working was to uninstall then re-install ruby.

    rvm remove 1.9.2

    rvm install 1.9.2

    Thanks to tip from @doublebee here: https://github.com/flori/json/issues/78#issuecomment-1499920

    0 讨论(0)
  • 2020-12-06 09:44

    You only need use rvm (ruby version manager)

    rvm uninstall 1.9.3
    

    and then

    rvm install 1.9.3
    

    looks this error is on build of rvm 1.9.3, but uninstall and reinstalling fix the problem with bcrypt-ruby 3.0.1

    0 讨论(0)
  • 2020-12-06 09:50

    I had the same problem installing under OSX 10.7.3. When installing the gem, my error message was:

    Building native extensions.  This could take a while...
    ERROR:  Error installing bcrypt-ruby:
    ERROR: Failed to build gem native extension.
    
    creating Makefile
    
    make
    compiling bcrypt_ext.c
    make: /usr/bin/gcc-4.2: No such file or directory
    make: *** [bcrypt_ext.o] Error 1
    

    Looks like the gem is looking for gcc-4.2 but I only had a file called gcc. Now since I had just installed the latest Xcode (4.3), I knew that my C compiler was compliant but the gem had gcc-4.2 hardcoded into it. So my solution was:

    sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
    

    The linking worked like a charm.

    0 讨论(0)
  • 2020-12-06 09:53

    I think you need to reinstall bundler gem.

    gem install bundler and then bundle install

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