简体   繁体   中英

Jruby :- Unable to install devise on windows using jruby

unable to install devise on windows using jruby

===============================================

C:>jruby -S gem install devise Building native extensions. This could take a while... ERROR: Error installing devise: ERROR: Failed to build gem native extension.

c:/jruby-1.5.3/bin/jruby.exe extconf.rb

make 'make' is not recognized as an internal or external command, operable program or batch file.

Gem files will remain installed in c:/jruby-1.5.3/lib/ruby/gems/1.8/ gems/bcrypt-ruby-2.1.2 for inspection. Results logged to C:/jruby-1.5.3/lib/ruby/gems/1.8/gems/bcrypt- ruby-2.1.2/ext/mri/gem_make.out

===============================================

can we build native extension using jruby, just like in ruby using DevKit, somethig like in jruby in windows

I just figured this out, and I am so glad I did because I am using Devise for a production application that is being deployed to Tomcat, and bcrypt was causing me grief. ANYWAY, here's what you do:

  1. Make sure you are using a version of Ruby from RubyInstaller
    • Download and install which ever version of Ruby you want
    • I should mention that I am using Ruby 1.8.7 and have not tested this for Ruby 1.9+
  2. Download the latest DevKit as well from RubyInstaller .
    • Extract DevKit, but do not set it up at this point
  3. Download and install JRuby
  4. At this point, both RubyInstaller Ruby and JRuby should be available on your path
    • A simple check would be is to open a command prompt window and type
      • jruby -v outputs jruby 1.5.5 (ruby 1.8.7 patchlevel 249) (2010-11-10 4bd4200) (Java HotSpot(TM) Client VM 1.6.0_21) [x86-java]
      • ruby -v outputs ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
  5. cd to the directory where you extracted DevKit
  6. Type ruby dk.rb init
  7. IMPORTANT: Open config.yml and make sure that both your jruby and ruby installations are listed. If not, ADD them. Save and close config.yml after you're done.
  8. Back in your command prompt window, type ruby dk.rb install . This will install DevKit to all the ruby installations listed in your config.yml . Most important of all, IT WILL ALSO INSTALL IT INTO YOUR JRUBY INSTALLATION!
  9. Once installation is done, give it a whirl by typing jruby -S gem install bcrypt-jruby

     C:\\>jruby -S gem install bcrypt-ruby --no-ri --no-rdoc JRuby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl for full support. Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed bcrypt-ruby-2.1.2 1 gem installed 

BINGO! BANGO!

bcrypt-ruby现在从3.0.1版本开始提供预构建的Java gem,因此您无需编译即可使用Rail 3.1来启动和运行。

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