简体   繁体   中英

gem install rails output error in ubuntu

I'm new to this environment and I'm trying to install rails. I installed ruby and checked using rvm list I get ruby-2.0.0-p0 as my current and default. I tried to install rails after installing ruby

gem install rails

getting errors:

ERROR: Loading command :install (LoadError)
       cannot load such file -- openssl
ERROR: while executing gem ... (NoMethodError)
       undefined method `invoke_with_build_args` for nil:NilClass

You are missing openssl there :)

Install the openssl package

rvm pkg install openssl

Remove the Ruby installation you're using

rvm remove 2.0.0

And finally recompile Ruby with openssl

rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr

Everything should be working now. Don't forget to:

rvm use 2.0.0 --default

For cool kids who compile from source, I had this issue even though I had OpenSSL installed on my machine with the newest version. It turned out I needed this library still:

sudo apt-get install libssl-dev

Then I just recompiled and everything worked.

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