I really need some help, I am not a Ruby expert and I am trying to get an existing ruby app to run on my Ubuntu server.
I think I have done everything correctly but I keep on getting the following error:
Warning! PATH is not properly set up, $GEM_HOME is not set,
usually this is caused by shell initialization files - check
them for 'PATH=...' entries,
As well as
You are using '.rvmrc', it requires trusting, it is slower and it is
not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
Here is the output from rvm info:
rvm info
Warning! PATH is not properly set up, $GEM_HOME is not set,
usually this is caused by shell initialization files - check
them for 'PATH=...' entries, it might also help to re-add RVM
to your dotfiles: 'rvm get stable --auto-dotfiles',to fix
temporarily in this shell session run: 'rvm use ruby-2.2.1'.
system:
system:
uname: "Linux ip-172-31-22-20 3.13.0-83-generic #127-Ubuntu
SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 hour 16 minutes 14 seconds ago"
path: "/usr/local/rvm"
homes:
gem: "not set"
ruby: "/usr/local/rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/usr/local/rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-2.2.1/bin:/usr/local/rvm/gems/ruby-2.2.1#global/bin:/usr/local/rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.2.1"
IRBRC: "/usr/local/rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
THANKS!!!!
UPDATE
Thanks, I was able to set the GEM_HOME and GEM_PATH values by using:
export GEM_HOME=/usr/local/rvm/gems/ruby-2.2.1
export GEM_PATH=/usr/local/rvm/gems/ruby-2.2.1:/usr/local/rvm/gems/ruby-2.2.1#global
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
However when I change folders and go back, I get an error (see below) and the variables are no longer set.
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /var/www/XXXXX/MicoBackup/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
Gemset 'XXXXXX' does not exist, 'rvm ree-1.8.7-2012.02 do rvm gemset create XXXXXX' first, or append '--create'.
Looks like a duplicate of: https://unix.stackexchange.com/questions/203376/how-to-set-ruby-gem-home-and-gem-path
As the error message indicates, you're missing GEM_HOME in your PATH.
Start by making sure rvm is properly sourced in your .bash_profile:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
If that doesn't work, you can try setting GEM_HOME manually. See the provided link above.
Related
I have an ubuntu machine and I am trying to install rubygems using RVM by following this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
When I run the command rvm rubygems current or even the command rvm rubygems latest I get the following error:
fl4m3ph03n1x: ~ $ rvm rubygems current
system - #downloading rubygems-2.4.8
system - #extracting rubygems-2.4.8.....
system - #removing old rubygems.........
$LANG was empty, setting up LANG=en_US.utf8, if it fails again try setting LANG to something sane and try again.
system - #installing rubygems-2.4.8.
Error running 'env GEM_HOME=/home/fl4m3ph03n1x/.rvm/gems/system#global GEM_PATH= /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby -d /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8/setup.rb --no-document',
showing last 15 lines of /home/fl4m3ph03n1x/.rvm/log/1437602750_system/rubygems.install.log
[2015-07-22 22:05:50] /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby
current path: /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/fl4m3ph03n1x/.rvm/bin
command(7): env GEM_HOME=/home/fl4m3ph03n1x/.rvm/gems/system#global GEM_PATH= /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby -d /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8/setup.rb --no-document
env: /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby: No such file or directory
At first I thought the error was due to the --no-document flag, but after reading and trying this discussion on github, nothing changed.
I also checked this stackoverflow discussion but it doesn't seem to be applicable to my case because I have a fresh installation (no manually installed packages nor anything).
Over all I tried using commands like rvm get head and rvm stable but nothing seems to work.
What am I missing? Could this be a permission's problem somehow?
EDIT:
This is the result of rvm list:
rvm rubies
ruby-2.2.1 [ x86_64 ]
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
# * - default
I had ruby installed, but turns out it was not set in rvm.
To fix this first I tried using rvm use ruby --default, but I got the infamous "rvm is not a function" error.
To fix this, first run bash --login and then then rvm use ruby --default.
Once these steps are complete you can proceed with rubygems installation.
When i try install gem in rails app show my this error :
-bash: /usr/local/bin/bundle: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
Any idea as to why this is happening and how to fixed?
Thanks.
For me it was my path setting, as revealed by rvm
rvm list
output:
Warning! PATH is not properly set up, '/Users/user/.rvm/gems/ruby-2.2.6/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.6'.
rvm rubies
=* ruby-2.2.6 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Before checking my PATH, I ran the suggested command:
rvm use ruby-2.2.6
After that, the bundle command worked just fine. I then located where my PATH had got corrupted, and fixed that.
I had to reinstall RVM this afternoon and am still struggling with the following problem - when I load a new terminal window (iTerm2 Build 1.0.0.20130624 with zsh 4.3.9 (i386-apple-darwin10.0)), rvm 'forgets' my gemset data.
This is a fairly common issue, but everything I've tried hasn't worked. I've done this (omitting the create as the gemset was already made):
rvm use --default 2.0.0#<gemset_name>
and this obviously doesn't work since I'm using ZSH:
Command: /bin/bash --login
so then i tried this, specifically for ZSH, but that didn't work either - upon opening iTerm I got the following error:
## exec failed ##
argpath=/usr/local/bin/zsh error=No such file or directory
I changed the command in iTerm preferences to
~/.zlogin -l
since I had added this to .zlogin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
that also didn't work, throwing this error:
## exec failed ##
argpath=/Users/<username>/.zlogin error=Permission denied
So I switched the 'Login Shell' back to "" in iTerm preferences (so it would load without errors) and tried this in the command line:
$ source $HOME/.rvm/scripts/rvm
which gave me
source: no such file or directory: /Users/<username>/.rvm/scripts/rvm
so now I'm really confused. why is there no .rvm in my ~ directory?
Finally, here's the result of rvm info upon reopening iTerm:
system:
system:
uname: "Darwin <users>-MacBook-Pro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386"
system: "osx/10.6/i386"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"
rvm:
version: "rvm 1.21.16 () by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 33 minutes 38 seconds ago"
path: "/usr/local/rvm"
homes:
gem: "not set"
ruby: "/usr/local/rvm/rubies/ruby-2.0.0-p247"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/gem"
rake: "/usr/local/rvm/gems/ruby-2.0.0-p247#global/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-2.0.0-p247#<gemset>/bin:/usr/local/rvm/gems/ruby-2.0.0-p247#global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p247/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/<username>/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.0.0-p247"
IRBRC: "/usr/local/rvm/rubies/ruby-2.0.0-p247/.irbrc"
RUBYOPT: ""
gemset: ""
You have a system installation of rvm - /usr/local/rvm, it is not recommended for basic use (mainly because of the problems you have and many others).
Start with cleaning ~/.zshrc from forced PATH= as it is described in this pull request https://github.com/robbyrussell/oh-my-zsh/pull/1359
Then update RVM:
rvmsudo /usr/local/rvm/bin/rvm get head --auto-dotfiles
and restart computer.
There is problem with system installation that it is loading early and the default ruby is loaded when computer is started, you need to restart computer for the new default to be effective. This problem does not happen when you use user installation of rvm.
optionally
Remove system installation and install rvm for user:
Remove system rvm:
rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm
Restart computer to get rid of environment variables (yes this is required).
Confirm that environment is clear from rvm (should be empty output):
env | grep rvm
Install user rvm:
\curl -L https://get.rvm.io | bash
I created a new Rails API app. I am trying to create the database table for the app with the command for a postgres db
rake db:create:all
and Im getting this error:
AM#~/Documents/RailsWS/iosprototypevendors >rake db:create:all --trace
rake aborted!
Valid types are [:development, :runtime], not nil
/usr/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:52:in `initialize'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `new'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `search'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-
..............
A bunch of googling I found out that this might have something to do with the wrong version of ruby picked up.
(I recently upgraded my OS to Mountain Lion and had to upgrade my Rails and Ruby versions to the latest. Went through hell for 8 hrs to get rails up and going. Rails works now on my system but this is one discrepancy that just popped up).
In addition
I also noticed that for different rails apps on my system when I check their versions using rails -v the versions of rails sometimes come up as 3.2.1 and other time 3.2.8 and sometimes I get the above error message.
How can this be happenning?
Here is what I get by running this command:
rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin A-Ms-MacBook-Pro.local 12.1.0 Darwin Kernel Version 12.1.0: Tue Aug 14 13:29:55 PDT 2012; root:xnu-2050.9.2~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.15.8 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 day 22 hours 15 minutes 59 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin12.1.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]"
homes:
gem: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/bin/rake"
environment:
PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:/Users/AM/.rvm/gems/ruby- 1.9.3-p194#global/bin:/Users/AM/.rvm/rubies/ruby-1.9.3- p194/bin:/Users/AM/.rvm/bin:/Users/AM/.rbenv/shims:/Users/AM/.rbenv/bin:/usr/local/bin:/usr/ local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/PostgreSQL/9.1/bin/"
GEM_HOME: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194:/Users/AM/.rvm/gems/ruby-1.9.3-p194#global"
MY_RUBY_HOME: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
Any help is appreciated
EDIT
Here is what I get when I run the command
echo $PATH on my terminal
/Users/AM/.rbenv/shims:
/Users/AM/.rbenv/bin:
/usr/local/bin:/usr/local/sbin:
/usr/local/mysql/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/bin:
/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/bin:
/usr/local/bin:
/usr/bin:/usr/bin:
/bin:/usr/sbin:/sbin:
/usr/local/bin:
/Library/PostgreSQL/9.1/bin/
So these are the paths on my system
It's a know path issue. Check if your path contains the valid gem path. Did you install ruby without rvm as well? Take a look: Path's issue with bundler, to change or not to change?
So I didn't get the answers I was looking for. So after my own research I found out this, (in case4 others have this issue)
Mountain Lion ships with Postgresql and a native ruby version 1.8.7. The current ruby
version is 1.9.3. So once you upgrade to mountain lion upgrade your versions of rails
and ruby as well and makke sure you are running the right versions.
rvm is the version management tool on mountain lion and can update aand download these
for you. See this post here
Also if you install the upgrades you will have multiple versions of ruby and rails on
your computer. So it becomes important to set the right version as a default onyour
system. You must do that each time you open a terminal window by the command to check
the versions first: rails -v and ruby -v or rvm list
then you set the default versions like this rvm --default 1.9.3-p194 this will set the
default for that terminal session. If you want a more permanent setup per project then ]
you will have to create a .rvmrc file in the root of every project and specify the
vcersions there for that project to use. again see the post linked to above.
Ill edit this answer as I find more details. In the meanwhile if this answer helped you please consider voting for it . Thanks
I am struggling to get Rails to deploy on a server that has:
a factory installed Ruby (1.8.7) in /etc/
an updated Ruby (1.9.2p290) in /usr/local/bin/
the Ruby I want to be using(1.9.2p290) in /usr/local/rvm/rubies.
Is there a way to set a GLOBAL default Ruby in RVM for ALL users?
When I set default with rvm --default 1.9.2#railspre it'll work fine for that session. But, when I log back in the ruby switches back to the one in /usr/local/bin. And, due to RVM's hocus pocus, that I don't fully understand, I can't just edit the $PATH for it in .bashrc.
$PATH at login:
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/opt/subversion/bin:/usr/local/rvm/gems/ruby-1.9.2-p290#railspre/bin:/usr/local/rvm/gems/ruby-1.9.2-p290#global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin
$PATH after rvm --default 1.9.2#railspre:
/usr/local/rvm/gems/ruby-1.9.2-p290#railspre/bin:/usr/local/rvm/gems/ruby-1.9.2-p290#global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/opt/subversion/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
No matter what (before or after changing RVM's default) rvm default list says the same thing:
$ rvm default list
rvm rubies
=> ruby-1.9.2-p290 [ ppc ]
Ideas?
Edit- adding requested info
$ type rvm | head -1
rvm is a function
$ which ruby
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby
$ whereis ruby
/usr/bin/ruby
Please post the result of the following :
type rvm | head -1
rvm notes
which ruby
whereis ruby
rvm list known
Do =>
rvm use 1.9.2 --default
Being root and normal user do =>
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source .bash_profile
Restart your pc and see if it works.