bundler always not found when switched ruby version - ruby-on-rails

i am using rvm and my default ruby is the latest Ruby , but i want to swith ruby version to 2.3.8
and after i run rvm use ruby2.3.8 and i want to run bundle install it said bundle not found, and then i tried to install bundle gem install bundler
then error i got is:
ERROR: Loading command: update (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
i already re install rvm and read some question about that error on this SO to get openssll ( my openssl already installed by brew ) such this question
is there any way to solve this?

Related

Trying to install rails. Error1. no such file to load -- openssl Error 2. undefined method `invoke_with_build_args' for nil:NilClass

I'm trying to get rails downloaded to my machine. I am pretty sure this is an older setup and am not sure what is wrong. I've been at this for hours. Whenever I type rails c I get...
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
Then I type what it says to type and get:
ERROR: Loading command: install (LoadError)
no such file to load -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I explored this for a while and thought I didn't have openssl installed so I downloaded it and now when i type openssl i get a prompt that looks like "OpenSSL>" and when I type whereis openssl, I get usr/bin/openssl. Those two things lead me to believe that openssl is installed on my laptop but for some reason when I go to gem install rails I still get an error.
My ruby version is 1.8.7. This is the version the application I'm trying to gain access to was built in. I'm on a MacOS Mojave 10.14.16. If anyone has any tips or could point me in the right direction I'd very much appreciate it.
Thanks
You have to install OpenSSL first and recompile ruby again:
RVM:
rvm pkg install openssl
rvm reinstall ruby-1.8.7 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr
please write complete name version of ruby-1.8.7

How can I install using gem when I keep getting this zlib error?

I recently installed rails 4.1.8 from the repos in ubuntu. I installed ruby 2.0.0. I want to update to rails 4.2.0. I rvm'd to ruby 2.0.0. I try to update rails using
gem install rails -v 4.2.0
but receive this error
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
zlib1g-dev is already installed. I'm not sure what to do.
Thanks
I decided to simply uninstall everyting, a la
aptitude purge rails
Then start from scratch using this guide

Failed to install Rails on yosemite

I installed Ruby via rbenv. Currently, my pc has ruby 2.1.2p95 version installed. I have just started development in rails. So, don't know much about it.
But, I get some kind of error when I installed it.
$gem install rails -v 4.2.0
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Did you run rbenv rehash after installing that version of ruby? Perhaps your PATH is pointing to the wrong gem command?
I've run into something similar.
Try
xcode-select --install
Than perhaps give this a go if it still doesn't work:
rbenv uninstall 2.1.2p95
rbenv install 2.1.2p95

Rails 4 beta1 install error

Im having trouble getting the Rails 4 beta installed. I used RVM to install Ruby 2.0.0 and that seems to have succeeded ok. Here is the error I get when attempting to install the Rails gem;
$ gem install rails --version 4.0.0.beta1 --no-ri --no-rdoc
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Re-installing your RVM rubies with the latest versions should enable you to load all the dependencies required to install Rails:
rvm get head --autolibs=3
rvm pkg remove
rvm reinstall all --force

Error ('The program 'rails' is currently not installed.') creating rails3 application using RVM

I'm on Ubuntu 11
Tring to install rails 3.1
It seems like I install rails but then I can't use it.
I want to use rvm to install and use rails and I do not want to go the sudo apt-get route.
Thanks!
durrantm#castleLinux2011:~$ rvm list rubies
rvm rubies
ruby-1.9.2-p290 [ x86_64 ]
durrantm#castleLinux2011:~$ rvm use --create 1.9.2#rails3
Using /home/durrantm/.rvm/gems/ruby-1.9.2-p290 with gemset rails3
durrantm#castleLinux2011:~$ rvm list rubies
rvm rubies
=> ruby-1.9.2-p290 [ x86_64 ]
durrantm#castleLinux2011:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
durrantm#castleLinux2011:~$ sudo gem install rails
Successfully installed rails-3.1.0
1 gem installed
Installing ri documentation for rails-3.1.0...
file 'lib' not found
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found
durrantm#castleLinux2011:~$ rails
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
durrantm#castleLinux2011:~$
btw
durrantm#castleLinux2011:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
durrantm#castleLinux2011:~$
doesn't work either and I have danced around the zlib issue for about an hour.
Also:
rvm gemset install rails
installing rails ...
ERROR: Error running 'GEM_HOME='/home/durrantm/.rvm/gems/ruby-1.9.2-p290#rails3' GEM_PATH='/home/durrantm/.rvm/gems/ruby-1.9.2-p290#rails3' gem install rails ', please read /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log
rails failed to install ( output logged to: /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log )
durrantm#castleLinux2011:~$ tail -20 /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log
[2011-09-13 09:17:57] GEM_HOME='/home/durrantm/.rvm/gems/ruby-1.9.2-p290#rails3' GEM_PATH='/home/durrantm/.rvm/gems/ruby-1.9.2-p290#rails3' gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
durrantm#castleLinux2011:~$
no no, no rvmsudo.
rvm pkg install zlib && rvm install 1.9.2 (so it builds against that zlib that rvm installed) && rvm --create use 1.9.2#rails31 (to create a rails31 gemset and use it all on one go)
NOTE: use rvm install 1.9.2 if you used that to install originally. the -p290 shows up because it is a result of the fact that the ruby project has 290 as the official release and rvm picks up on that. This way with 1.9.2 and not 1.9.2-p290 when 1.9.2 series is jumped, rvm will pick up on that and install that instead. Otherwise if you originally did 'rvm install 1.9.2-p290' then do that instead.
As for the rails command. If you executed the above commands then you have been moved into the right rvm controlled ruby and gemset. If not then execute that command now (rvm --create use 1.9.2#rails31)
NOW you can execute gem install rails -v='3.1.0' (I added the version just in case rails changes before you see this)
This will install the rails gem and its deps into Ruby 1.9.2-p290's rails31 gemset. Now you can execute rails new test_app to test it. (I usually mkdir -p $HOME/tmp && cd $HOME/tmp && rails new test_app)
This should eliminate your problems.
You need to reinstall ruby. Follow the instructions in http://beginrescueend.com/packages/zlib/.
You might get the same problem with readline or openSSL, check the rvm website as they provide some workarounds for those libraries too.

Resources