I started using Terminator, the teminal emulator, but when I run a rails application it can't find Rails.
humberto#asterix:~$ rails -v
The program 'rails' can be found in the following packages:
* rails
* ruby-railties-3.2
Try: sudo apt-get install <selected package>
Does anyone knows how to solve it?
Ensure RVM is Properly Loaded
I don't know anything about your terminal emulator, but it's likely that your environment isn't being properly modified for use by RVM. Make sure your shell sources a file that contains the following:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Depending on your shell and emulator, this is likely to be one of:
~/.profile
~/.bash_profile
~/.bashrc
If all else fails, just create a shell script that contains the necessary line and source it interactively into the current shell. For example, you might create a script and then source ~/bin/my_rvm_setup.sh to set up the correct environment variables and shell functions.
You can simply run terminator from default gnome terminal by the command:
terminator
Than terminator will load paths defined for your default terminal. You can also load RVM on .bashrc file. To do that add this line on your ~/.bashrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Related
How do I get rid of this on my bash terminal?
I suspect that the code that triggers this is found in my .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Removing the line above, gives me back a prompt that Rails cannot be found, even if I have rails installed.
I had the same issue after running rvm get stable.
Since rvm needs to run in the shell session as a function, removing the line [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" from your .bash_profile or .bashrc is not an option as it will cause gems to not be found.
On my environment the cause was due to a conflict between an old installation of bash-it and rvm. If you're using bash-it and encountering this issue, this may help.
I took the following steps:
Backed up my .bash_profile (if you have .bashrc you may want to back it up as well).
Ran bash-it's uninstall script (see instructions in the link above) and removed ~/.bash-it folder.
Reinstalled bash-it.
Added to .bash_profile what was missing based on my .bash_profile backup created on step 1.
Reenabled the bash-it aliases, completions, and plugins that I needed.
As soon as I opened a new shell, I stopped receiving the error and rvm started working properly.
Can't find anything about this in Google.
Trying to get most out of vim-rails.
https://github.com/tpope/vim-rails
It has many interesting commands, like :Rserver, :Rgenerate, :Rdestroy, but they do not work on my machine. All they give same error:
No such file or directory
I would imagine it has something to do with paths, and RVM loading, but not sure what exactly.
Running on latest Lubuntu if that matters. Sometimes need to do /bin/bash --login to run rake.
--
Found somewhere that in ~/.profile I should put this:
# PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
Still same error.
--
Yes, vim-rails - is a plugin for vim that I'm trying to use.
-- Tried to run !/bin/bash --login from VIM - but it closes VIm.
Have you try to execute these commands in the normal way?
like rails server, rails generate..
From your description, mostly because vim-rails can't find ruby or rails command to execute.
You should check the $PATH variable to see whether it has ruby or rails load path in it.
Have you tried to open vim in your working directory?
For example, if your app is in ~/workspace/my_project/, then you should open vim in that directory:
cd ~/workspace/my_project
vim
Then the vim-rails should work as expected.
I just recently switched over to using zsh with oh-my-zsh and I am having issues using the rails command line tool. Here are the steps that I ran through, and the error that I am receiving.
I ran the curl command that the github page provides:
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
Then I went to run rails s, this is the following error message that I receive:
.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
This looks like I am having a gem error so I reinstalled rvm, rails and bundler with nothing solving the issue. However if I switch my terminal back over to bash then I dont have any issues and rails works perfectly fine. Has anyone else run into a similar issue? I want to use zsh because it seems like it has better features but if I can't use rails then I have to dump it to the curb.
These are the lines at the end of my .zshrc file:
export PATH=/Users/thomascioppettini/.rvm/gems/ruby-1.9.3p0/bin:/Users/thomascioppettini/.rvm/gems/ruby-1.9.3-p0#global/bin:/Users/thomascioppettini/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/thomascioppettini/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
What I have done to work bundle zsh and rvm, that is couple of body movies:
1) add to .zshrc at first line to correct find bin direcrory (your CO):
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
2) add next line after previous one:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
3) and at the end change PATH:
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
For me it is work fine (now it correct define $PATH with all rvm gemsets)
did you put the
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
into your .zshrc?
I assume the rvm-installer installs it only into .bashrc
Ok I got it to work by deleting the path that was set in the zshrc and copying the rvm lines from my bash_profile in order to get the right configuration from rvm. If you run the following command in your terminal it should work:
cat ~/.bash_profile >> ~/.zshrc
If you are using rbenv then copy this line from bash.rc which you can access by sudo gedit ~/.bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"enter code here
eval "$(rbenv init -)"
then paste it to zshrc, which can be accessed by sudo gedit ~/.zshrc
I have installed ruby via rvm on Mint 11 no problem. Installed gems, ditto. Installed rails via gem install rails, and when I type rails -v it returns the correct version. Until I close that terminal and reopen a terminal. When I do that and type rails -v I get the message
The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails
If I then type
rvm use 1.9.2-p180 --default
and then type rails -v I again get the correct version...until I close the terminal.
I should add that I have added a path statement to my .bashrc pointing to the 1.9.2-p180 directory in my .rvm directory.
Typing ruby -v always returns the correct version.
Create .bashrc file and add .rvm command
$ sudo touch ~/.bashrc
$ sudo gedit ~/.bashrc
(Add line to .bashrc file)
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
Logout and Login OR just update user profile from .bashrc with following command
$ . ~/.bashrc
Try adding this command to your .profile and reopening your shell:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Use project rvmrc files. You can see how to set this up here http://beginrescueend.com/rvm/best-practices/
That way you keep all your gems seperate for each project and it's dead simple to set up
Try which rails. Maybe there is a link to a stub that gives you the note.
If that is the case calling the full path might help, e.g. /usr/local/bin/rails
I am a newbie RoR developer (and pretty newbie for programming in general). I followed the installation instructions on http://rvm.beginrescueend.com/rvm/install/ to a T. I added...
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
...to my .profile and .bash_profile (at the very end) and yet I still cannot load RVM as a function. Note that I am getting -bash: ??: command not found" in Terminal.