not able to install rails3 on rvm - rvm

When trying to install rails3 using rvm, I get following error.
$ gem install rails
/data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:28:in `<top (required)>': uninitialized constant Gem::ConfigFile (NameError)
from /data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:8:in `<top (required)>'
from /data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /data/home/manish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin/gem:9:in `<main>'
Here is my rvm information
$ rvm info
ruby-1.9.2-p180:
system:
uname: "Linux alioth-linux.gslab.com 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:55:12 EDT 2007 i686 i686 i386 GNU/Linux"
bash: "/bin/bash => GNU bash, version 3.2.25(1)-release (i386-redhat-linux-gnu)"
zsh: "/bin/zsh => zsh 4.3.4 (i386-redhat-linux-gnu)"
rvm:
version: "rvm 1.6.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p180"
date: "2011-02-18"
platform: "i686-linux"
patchlevel: "2011-02-18 revision 30909"
full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]"
homes:
gem: "/data/home/manish//.rvm/gems/ruby-1.9.2-p180"
ruby: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180"
binaries:
ruby: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin/ruby"
irb: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin/irb"
gem: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin/gem"
rake: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin/rake"
environment:
PATH: "/data/home/manish//.rvm/gems/ruby-1.9.2-p180/bin:/data/home/manish//.rvm/gems/ruby-1.9.2-p180#global/bin:/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/bin:/data/home/manish//.rvm/bin:/data/home/manish/ec2-api-tools-1.4.0.2/bin:/data/data/work/java/jdk1.6.0_18/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/data/home/manish//bin"
GEM_HOME: "/data/home/manish//.rvm/gems/ruby-1.9.2-p180"
GEM_PATH: "/data/home/manish//.rvm/gems/ruby-1.9.2-p180:/data/home/manish//.rvm/gems/ruby-1.9.2-p180#global"
MY_RUBY_HOME: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180"
IRBRC: "/data/home/manish//.rvm/rubies/ruby-1.9.2-p180/.irbrc"
RUBYOPT: ""
gemset: ""
Thanks for any help.
Regards,
Manish

Do
rvm rubygems remove
Which will then say:
Removing old Rubygems files...
Installing rubygems dedicated to ruby-1.9.2-p180...
After which the gem command worked.
Edit: Nevermind, seems there's more to it.

I had precisely the same error message when upgrading to Ubuntu 11.04 and found that I'd installed rvm whilst missing a few essential libraries.
I know that you aren't using the same flavour of Linux as me; the following worked for me and you may be able to find an equivalent:
$ sudo apt-get install build-essential ruby-full bison openssl libreadline5 libreadline5-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclient-dev libxslt-dev libxml2-dev libcurl4-openssl-dev #install the missing libraries
$ rm -r ~/.rvm* # destroy the old rvm installation
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) # install rvm again
$ rvm install 1.9.2

I had the same problem on Ubuntu 10.04.
In the RVM install script output, it indicates which Ubuntu packages are required.
For example, on my system it had:
build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
Installing those with apt-get, 'rvm implode', and re-running 'rvm install 1.9.2' fixed the problem.

Related

Rbenv: Ruby not installed Command 'ruby' not found (AWS t3a Ubuntu 18.04)

I'm trying to install Ruby via Rbenv on Ubuntu 18.04 on AWS t3a using these instructions: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04
sudo apt update
sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.6.3
rbenv global 2.6.3
However, after the rbenv global 2.6.3 part and then run ruby -v, I get
Ruby not installed Command 'ruby' not found
But when I run rbenv versions it tells me 2.6.3 is listed.
How can I install ruby?
Used screen -d -r to see the error message which was uncommon.mk:545: recipe for target 'rdoc' failed
Found the solution in https://github.com/postmodern/ruby-install/issues/223
Instead of:
rbenv install 2.6.3
Do:
RUBY_CONFIGURE_OPTS=--disable-install-doc rbenv install 2.6.3
Try
bundle exec ruby
And should be work

Get Error: You must install at least one postgresql-client-<version> package when deploy to heroku

sdilshod#sdilshod-Lenovo-B590:~/webapp/saturn$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6194
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Error: You must install at least one postgresql-client-<version> package.
rake aborted!
Error dumping database
/app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:415:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:188:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:182:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)
heroku pg:psql works fine, but when i do migrate rake db:migrate it get error that needs to install pg client. Where i need to install pg client? Any help
On a Debian based system the PostreSQL client programs are provided by postgresql-client-common as symbolic links to /usr/share/postgresql-common/pg_wrapper.
If you install that package and attempt to use any of the PostgreSQL client programs like psql, pg_dump, pg_dumpall, and pg_restore, the pg_wrapper without having the version specific binary package installed, like postgresql-client-9.1 it will emit this error:
You must install at least one postgresql-client-< version > package
The easiest way to fix this is to install the postgresql-client metapackage. It always depends on the currently supported database client package for PostgreSQL on Debian based systems and it depends on postgresql-client-common
sudo apt-get install postgresql-client
Update March 30th, 2020
Agree with the chosen answer, but I found to install postgresql-client-12 on a Ubuntu 18 slightly more involved.
sudo apt update
sudo apt -y install vim bash-completion wget
sudo apt -y upgrade
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12
See this reference for details.
For Ubuntu 18.04.6 LTS it works with only two commands;
sudo apt-get install postgresql-client-common
and
sudo apt-get install postgresql-client
with new version postgresql 14, I follow up this document
http://apt.postgresql.org/pub/repos/apt/README
$ sudo su -
$ lsb_release -c
Codename: focal
$ echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-client-14

gem install pg only works as sudo

I have read a lot on this topic, but seems like nobody has had the exact problem I am having.
I am trying to install Postgres support for Rails 3 on Ubuntu. If I run:
sudo gem install pg
everything works fine.
However, I am using GemFile and trying to deploy my application to Heroku, so doing:
bundle install
As part of the bundle install it fails when doing gem install pg with the following error:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.9/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /Library/PostgreSQL/9.1/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
Any ideas why this is happening. Surely it would also fail to install as sudo if I do not have the correct libraries installed. Is this some kind of permissions problem?
Thanks for your help in advance,
Olli
I believe you need to install libpq. Please try:
sudo apt-get install libpq-dev
And btw, this may be a helpful hint for you. I usually setup my development environment using this chain (this is valid for Ubuntu 12.04 LTS):
sudo apt-get install libpq-dev build-essential openssl libreadline6 libreadline6-dev curl zlib1g \
zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev \
autoconf libc6-dev ncurses-dev automake libtool bison subversion ncurses-term \
exuberant-ctags libnotify-bin curl autoconf make automake ssh git-core git-doc imagemagick libpq-dev vim \
libreadline5 libmysqlclient-dev imagemagick libmagick+5 \
libmagick++-dev libmagickwand4 libmagickcore4 libmagickcore4-extra libmagickcore-dev \
libmagickwand-dev \
tmux libcurl4-openssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 postgresql-contrib mysql-server memcached \
gimp chromium-browser chromium-codecs-ffmpeg-extra chromium-browser-inspector \
bind9 terminator libqt4-dev xvfb gitk postgresql pgadmin3 rar unrar\
ubuntu-restricted-extras vlc compizconfig-settings-manager gstreamer0.10-plugins-ugly flashplugin-installer

install ruby 1.9.3 using rvm on ubuntu [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Ruby 1.9.2 and Rails 3 cannot open rails console
I have already installed rvm and ruby 1.9.2, both working properly. Using rvm version 1.10.2. I previously installed the rvm packages readline/zlib, but now I'm having big troubles with readline now. I'm trying to install ruby 1.9.3 in rvm, but I always end up having readline not found.
I tried to follow different solutions:
rvm remove 1.9.3
rvm pkg install readline
rvm install 1.9.3 --with-readline-dir=$rvm_path/usr/ \
--with-zlib-dir=$rvm_path/usr/
rvm use 1.9.3
rvmsudo gem install bundler
bundle install (all gems installed fine)
rails c / rails s
.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': \
cannot load such file -- readline (LoadError)
I have libreadline-dev (version 6, the current one) installed (everything needed by those packages pretty much)
I also tried the following:
.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \
--with-readline-dir=/home/claudiocontin/.rvm/usr/
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \
--with-readline-lib=/home/claudiocontin/.rvm/usr/
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
Makefile is not generated of course ...
apt-get install libreadline-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libreadline-dev is already the newest version.
Ideas?
I tried to do rvm pkg readline, install ubuntu pkgs etc without any success. What worked for me:
gem install rb-readline
And add the following line to your Gemfile:
gem 'rb-readline'
What I ended up doing is remove all the libreadline from rvm usr/lib/ path.
Installed libreadline5-dev package (.deb in this case) downloaded manually, because the new ubuntu distro has only libreadline6-dev as candidate.
went to rvm ruby 1.9.3 src and:
ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
make
sudo make install
Now works like a charm.
Very painful stuff :)
edit:
also keep in mind that readline uses also libeditline-dev now, you can disable manually when configure ruby readline , passing: --disable-libedit
ruby extconf --disable-libedit
I've always found getting RVM to play nicely with packages to be a bit of voodoo. A lot of times, it's about catching a dependency - I put together a script that I've had luck with in past, try this:
sudo apt-get install zlib1g-dev libssl-dev libsqlite3-dev libmysqlclient-dev imagemagick librmagick-ruby libxml2-dev libxslt1-dev build-essential openssl libreadline6 libreadline6-dev zlib1g libyaml-dev libsqlite3-0 sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libpq-dev libpq5 libmysql-ruby libmysqlclient-dev
rvm pkg install autoconf
rvm pkg install zlib
rvm pkg install readline
rvm pkg install openssl
rvm pkg install iconv
rvm install 1.9.3
rvm use 1.9.3 --default

debug rails 3.1.1 application

I'm try to add a debugger to my rails 3.1.1 application which uses ruby 1.9.2. I have added the following to my gemfile:
gem 'ruby-debug19', :require => 'ruby-debug'
and I get the following error:
/.rvm/gems/ruby-1.9.2-p290#rails31/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:55:in `block (2 levels) in initialize': uninitialized constant Debugger::LocalInterface::Readline (NameError)
by the way i have the following:
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
$ rails -v
Rails 3.1.1
$ rvm -v
rvm 1.8.6 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]
What made is work for me is:
sudo gem install ruby-debug19
gem install linecache19
gem install ruby-debug-base19
bundle update
rails server -u
Did you install all the prerequisites listed in rvm notes before you installed Ruby? I'm not positive, but I think readline is a dependency for MRI on Linux.
You may also follow these instructions from the RVM site:
If you have an error when compiling pertaining to readline, you may
need to attempt installing with the procedure defined below.
NOTE: Before you follow the procedure below please be sure to verify
that you have installed any dependencies for the Ruby you are
installing listed by the 'rvm notes' command. If you have not yet done
that do so then run 'rvm remove X ; rvm install X' where X is the Ruby
that you are concerned with.
$ rvm pkg install readline
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr