I just switched from Heroku to Amazon Web Services. Previously I ran all of my Rails command line commands using my Command Prompt with Ruby (from my Windows PC). However, after I logged into my Amazon Linux EC2 instance, and then went into the directory of my app I receive this error:
/usr/bin/rails:9:in `require': no such file to load -- rubygems (LoadError)
from /usr/bin/rails:9
when I try to run any commands like rails console.
I reviewed this question, but it doesn't seem like multiple Ruby libraries apply to me because
which -a ruby
only yields one location:
/usr/bin/ruby
Also, this question didn't seem to help as I haven't. When I tried typing in
rvm use 1.9.3
I receive this message:
-bash: rvm: command not found
It's my first time seeing a Linux environment, so any help would be appreciated. Thank you!
I was running into he same issue with the identical error message. From my EC2 instance, I noticed my ruby version was 1.8 (ruby -v). I rebooted the EC2 instance, and this caused Elastic Beanstalk to spin up a new EC2 instance and terminate the old one. The new instance was running 1.9.3, and I became unblocked. I hate magical solutions, but with the old instance terminated, there was no more triage I could do. Hope this helps.
-bash: rvm: command not found
This clearly says that rvm is not installed on your machine or if installed you haven't set the path properly.
Check path
Sometimes there is gem versioning pointing to the wrong one.
This happened with me sometime back----
Disregard! sudo bundle install was bundling 2.3.8 instead of 3.0.0.beta3. Fixed it by specifying the version in my Gemfile.
To make sure the compilation goes smoothly, scroll back in your terminal session and look at the list of prerequisite packages that should be installed (it’s probably best to cut and paste the whole lot of names to save yourself from typing errors).
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion
Now you can use use rvm to download, compile, and install Ruby.
1 rvm install 1.9.3
2 rvm use 1.9.3 --default
Guess it's more of a problem related to RVM and some weird linkage to osx's system ruby? (I installed RVM on a user level)
I have used gem install bundler.
Then run rvm install works fine
Related
I have been developing rails applications on windows xp. I now need to deploy these apps to a different computer, which has Ubuntu 10.04.1 LTS. To install ruby and rails on my windows machine, I used the RailsInstaller. I now need to get ruby and rails working on my Ubuntu machine. It isn't connected to the internet so pretty much every tutorial I found hasn't worked. Can I just transfer my installed files from my windows machine? In my RailsInstaller directory on my windows machine, there is the following directories: DevKit, Git, Ruby1.9.3, and scripts. It also has unins000.exe and unins000.dat. Will it work to just transfer these files or is there some other way to get ruby on rails working on my Ubuntu machine?
Windows and Ubuntu are two different operating systems. Read about operating systems here
You cannot copy software files from one Operating system to another. You can only move code and documents (images, music etc).
Anyway, since you are using Ubuntu, the tool that allows you to install software is called 'aptitude'. You will install software 'packages' from the terminal. It is similar to the command prompt in windows. You can open it by searching in the dash.
The command to install software is apt-get install package-name. You need to give it root privileges so you will have to prefix the command with sudo.
By default aptitude will fetch package from online repositories. But you can also make it install from a local file.
Another way for offline installation is to get the '.deb' package file of the software and run dpkg -i filename.deb.
Okay. So the idea is to download the software packages needed for ubuntu and use the installation tools provided to install them.
Ok For Ruby we have something called Ruby Version Manager or RVM. It allows you to have multiple versions of Ruby on your computer. I think that wont be necessary for you. But still we will go with RVM because of its ability to let you install ruby offline with ease.
Read more here: http://rvm.io/rvm/offline
As you might know, Rails is a gem of Ruby. In the above link you will find how to install Gems offline. Just download the Rails gem and install it using the local option of bundler. Ok I might have confused you with this paragraph. But you read the RVM documentation and you will understand.
If you do get an internet connection, there is an awesome tutorial (step by step) at DigitalOcean.com to guide you.
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
I know its for Ubuntu 12.04. But you wouldnt face much problem.
Good luck. And learn about operating systems.
Installation of Ruby on Rails for Production server is pretty straight forward. Below are the relevant steps.
1.INSTALL THE NEEDED LIBRARIES
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev
2.DOWNLOAD AND INSTALL RUBY 1.9.3
sudo apt-get update
sudo apt-get install ruby1.9.3
Note you can install latest Ruby too.
3.INSTALL RAILS
sudo apt-get install ruby-dev
sudo apt-get install build-essential g++
sudo gem install railsconfigure rails application with nginx and unicorn
4.INSTALL SQLITE ADAPTER
sudo apt-get install libsqlite3-dev
If you passed all above steps without any ERROR, Now it's time to create a rails demo application OR SCP existing one and test it out.
Below is the steps to create new rails application
rails new demo
cd demo
uncomment therubyracer gem in Gemfile
sudo apt-get install build-essential g++
bundle install
rails g scaffold order name:string
rake db:create
rake db:migrate
Open config/routes file and uncomment root 'welcome/index' and replaced with 'orders/index'
$rm -rf public/index
That's all, Now run your Rails application.
Checkout http://railscasts.com/episodes/335-deploying-to-a-vps and search for "capistrano" to deploy. It's an art.
"It isn't connected to the internet so pretty much every tutorial I found hasn't worked"
You are way off the beaten path here. but if you can get your git repo to a machine that is connected to the internet, you can deploy to Heroku easy, and/or run capistrano from there.
I'm new to Ruby on Rails. I'm trying to install rails on an ubuntu linux platform. I've already installed RVM and ruby. When I type
gem install rails --version 3.0.0
I get this error:
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
Please help me install rails and learn a bit about the command line while I'm at it.
looks like you dont have ZLib installed. try gem install zlib and also apt-get install zlib zlib-dev if you dont have the system library installed
you need both the .so c-extension files (apt-get)
and the ruby interface to them (gem )
also this may be the same thing as in Antother Stackoverflow Question
I guess you need zlib package to install rails.
try
rvm pkg install zlib
after that
sudo apt-get install zlib1g
and then the development package. not sure why but you need it.
sudo apt-get install zlib1g-dev
then remove the current version of ruby because you didn't have zlib when ruby was compiled. type
rvm remove 1.9.2
(replace 1.9.2 with your version)
and then install it again with
rvm install 1.9.2
(again your version here)
That's basically it. I had the same error and it worked for me, hope it helps you too.
This has happened to me a few times. The answers near the bottom should fix it, but unfortunately you will need to remove and then recompile ruby :(
I have never gotten it to work without totally removing ruby.
http://ubuntuforums.org/showthread.php?t=1494997
I am getting the following error:
$script/console
Loading development environment (Rails 2.2.2)
/opt/ruby-enterprise-1.8.6-20080709/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
Where can i get the file and what directory should it go in?
Thanks!
The readline module is normally part of the Ruby package itself.
Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.
On Debian/Ubuntu:
apt-get install libreadline-dev
Or on RHEL/CentOS, try
yum install readline-devel
Update:
You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list in a text editor, and change all occurrences of archive.ubuntu.com to old-releases.ubuntu.com. Then, run apt-get update and try the above again.
I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.
You need to install the ncurses and readline libraries.
On Ubunutu you could do
sudo apt-get install libreadline5-dev libncurses5-dev
and then you will have to recompile readline which comes with your ruby source
cd <ruby-src-dir>/ext/readline
ruby extconf.rb
make
sudo make install
If you are using RVM you could simply do
rvm package install readline
EDIT:
On newer RVM versions, this last command is
rvm pkg install readline
Add the following line to your Gemfile and run bundle update
gem 'rb-readline'
credits to similar question/answer at install ruby 1.9.3 using rvm on ubuntu
This easiest way to get relief from this problem,
just add to your Gemfile:
gem 'rb-readline'
And then run bundle install
Run the command
rvm requirements
It shows the requirements and dependencies. Install those and reinstall the ruby on rvm
rvm remove 1.9.2
rvm install 1.9.2
It works!
EDIT
If you can't find the requirements option update your rvm.
rvm update --head # older rvm
or use rvm upgrade
Maybe this is a bullshit answer, but I ran into this problem today after upgrading postgres from 9.5.3 to 9.6, along with which homebrew upgraded readline from 6.something to 7. I ended up rolling back my postgres to 9.5.3 and that resolved the issue.
I am trying to get a Ruby on Rails app hosted free somewhere, and Heroku is looking like my last resource. It is supposed to work on Linux, and the gem installs with no errors, but whenever I run any Heroku command it spits out several errors, all connected, and talking about a failed 'require.' I looked it up in the code, and it says:
require 'readline'
That is it.
I have tried to install every variation of libreadline that I can find and think of, but none of it makes any difference. Any ideas here?
It could be that your system installed version of Ruby is not build with readline support. If so then you could reinstall it from source and select the correct configure parameters for readline support. That's not only annoying but means you'd have to manually maintain updates yourself.
Better still would be to abandon your system Ruby altogether in favor of one installed with RVM
Install RVM as described here
Install libreadline-dev
$ sudo apt-get install libreadline-dev
Install a version of ruby (e.g. 1.8.7)
$ rvm install 1.8.7
$ rvm --default 1.8.7
Install your rails and Heroku gems under the RVM ruby
$ gem install rails heroku taps ... # Note no sudo!
See if your problem persists
If so, then do this:
$ cd ~/.rvm/src/ruby-1.8.7-p299/ext/readline
$ ruby extconf.rb
$ make
$ make install
Ubuntu's ruby-full package depends on libreadline-ruby and should pull in everything both you and it needs. If you have tried installing ruby by installing a bunch of separate packages you might be missing something. If that's the case go back and install ruby-full.
I have a script I use to rebuild my Rails Environment whenever I install the latest Ubuntu. It installs everything you need for Heroku (which is where I host my apps) as well. You might want to take a peek at it and see if there is anything there that you are missing.
If ruby-full doesn't sort you out, I would second Bjg's advice and ditch the system ruby for RVM.
I got it to work, but it was rather a hack. I hunted down the readline.so file from where it was installed (in some strange spot) and did a hard link to where ruby was looking for readline, and it worked. Not optimum, and I will definitely try what you guys recommend next time. Thanks!
I've just moved over to Ubuntu 8.10 as my dev box; it's my first serious foray into Linux as a daily-use OS, and I'm having a hard time getting Rails going. I have followed a number of tutorials which all seem to work fine, but when I try and use gem install or gem update on anything, I get an error that looks like this:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
from /usr/local/bin/gem:21
I have (as recommended in the tutorials) installed zlib, zlib1g, and zlib1g-dev. I've even found a few tutorials on this particular problem (all for flavors other than mine, however) but they didn't help.
I'm on Ubuntu 8.10, ruby version 1.8.8dev gem version 1.3.2
I've tried reinstalling ruby and gems each and separately, to no avail.
If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/
The steps are:
rvm pkg install zlib
(or
rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)
then
rvm remove 1.9.1
rvm install 1.9.1
I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:
cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails
that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.
I have the same problem in CentOS and fix it by executing the following command:
First, I ensure that zlib and zlib-devel exist (like many suggested above).
yum install zlib zlib-devel
Second, I recompiled and installed the sources of zlib that comes with ruby.
cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install
That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)
That works for me...hope to you to.
Regards.
try
aptitude install zlib1g-dev
Then go about your business.
I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ...
So, ..
I'm installing a new box Ubuntu 8.04 LTS 64-bit ...
So, I ...
cd ~
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar -xvvf ruby-1.9.2-p180.tar.gz
cd ruby-*
./configure
make
install
sudo make install
And then I have this problem with ...
gem list
it doesn't work ... something about zLib not found crap ...
So, I actually READ the README and find that I need to edit a file ...
[my ruby source directory]/ext/Setup
and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column
Then I run the commands again ... included here for reference ...
./configure
make
install
sudo make install
and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions.
Joet
Just goto Ruby Source Package , Unzip it.
Goto /your-ruby-dir/ext/zlib
ruby extconf.rb
make
sudo make install
If the packages are missing it will tell you, mainly libzlib related packages
Regards
Saurabh
rvm package install zlib
rvm remove 1.9.1
rvm install 1.9.1
That did it. After numerous wild goose chases, I'm glad I found this page.
yes, and that didn't do the job either. Got this from another source, this finally did it for me where the other stuff failed.
wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar xvzf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb && make
sudo make install
Reinstall ruby gems from source
Thanks anyway, guys.
The problem is that Ruby on Ubuntu isn't built against zlib; you'll want to do a source build to install Ruby. You can do this with apt-get source -b ruby
Did you try apt-get install libzlib-ruby?
Also install rubygems from rubyforge. I don't like the rubygems package in Ubuntu.
On Debian (Squeeze):
libruby contains zlib for ruby amongst all the other stuff you'll need to make ruby work properly on Debian. So...
apt-get install libruby
Then...
cd /usr/local/src/ruby
make clean
make
make install
cd ../rubygems
ruby setup.rb
gem install rails
This made it work for me, but your mileage may vary. I did to a slight shotgun approach to zlib before finding that everything needed was covered by libruby.
You could try to download the ruby enterprise deb package on the phusion site. And install passenger through the package. Follow the instructions here.
Or you could try the bash script found here.
When running Rails I would not recommend using Ruby 1.8.8dev. Stick with 1.8.6, preferably the Ruby Enterprise Edition. See this post on RailsLab what other people are using.
If you insist on going hi-tech, install Ruby 1.9.1.
But in both cases build it yourself or use Marans suggestion.