I am trying to get Ruby on Rails going on my Windows 7 machine. I am using gitbash and have install ruby using ruby installer. All my gems have installed successfully (Rails 3.0.7), but when I try to run a command like rails s I get sh.exe": rails: command not found
echo $PATH gives me:
/c/Users/Dave/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Ruby192/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files/NVIDIA Corporation/PhysX/Common:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files/Common Files/Adobe/AGL:/c/Program Files/QuickTime/QTSystem/:/c/Program Files/Common Files/Microsoft Shared/Windows Live
Since the path for Ruby is in there I am at a bit of a loss for how to be able to start the rails server.
running gem install rails fixed it
This Problem confuses basic developers. Because they simultaneously use both Git Bash & Command Prompt with Ruby and Rails.
When we type "Rails any command" in CMD with Ruby and Rails, we don't see any failure. But if we run the same command in gitbash means, we get the result "Command not found". Running "Gem install rails" fixs it for gitbash users as the above sayings.
For those who use both Git and Cmd with ROR, they can get the command executed anyhow by running on any of the one...
Related
I recently started testing out the Ubuntu bash for Windows 10 sub-system for my Ruby and Rails work. To set up rails, I followed this guide from GoRails.com.
Everything worked yesterday. But after shutting down my PC and starting up the Ubuntu bash terminal again today, it doesn't seem to recognize ruby or rails anymore. i.e. typing ruby -v gives me this:
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt install ruby
Typing rails -v gives me:
bash: /mnt/c/Ruby22-x64/bin/rails: ruby: bad interpreter: No such file or directory
For reference, I used the instructions from the above guide to install Ruby 2.4.0 using RVM and Rails 5.1.1. When I ran ruby -v and rails -v yesterday, everything worked fine.
I should note, that before testing out the Ubuntu sub-system, I've been using Ruby and Rails on Windows itself - In this case, I have Ruby 2.2.5 (64-bit) installed using an installer downloaded from here. I installed Rails on Windows by running gem install rails on the Windows command prompt.
I am on Windows 10 Home Version 1703 (OS Build 15063.483)
from your story above, probably how you start the terminal (command prompt)
if you run using go rails make sure your run the terminal with bash, press start, then search for bash then you click bash icon
if you using ruby from ruby installer / rails installer you search "command prompt with ruby and rails" and click the icon
Firstly install ruby using rvm manager. It enables you to switch between different ruby versions as per your project.
Follow the instructions on this website:
http://rvm.io/rvm/install
and install ruby through rvm.
For the problem of unable to detect ruby on your system change settings for your terminal through Edit->preferences/profile preferences -> command ->(tick mark) run command as login shell.
I've installed rails using rvm and everything works well in the out of the box terminal using zsh. I thought i'd simplify things a bit and bring out Coda's terminal but for some reason when I run
$ rails --version
I get errors saying there are missing dependencies or when using $ rails new new_app Coda terminal tells me that rails isn't installed. running $ gem list and $ gem environment give me the same output in both terminals.
you need to load rvm before using it
load rvm script with
source ~/.rvm/bin/rvm
I am using ubuntu 12.04 LTS.I have successfully installed ruby via rvm and rails.I can also see which version of rails and ruby in terminal by typing rails -v,ruby -v successively.On the other hand,I have installed terminator on my ubuntu and I have faced an error message while I was typing rails -v:
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
When I have typed ruby -v,no error message,it prints the version,no problem.
Please be noted that I have already installed ruby and rails successfully and it works correctly with terminal.
Here are some pictures of the situation:
http://imageshack.us/f/819/screenshotfrom201206281.png/
http://imageshack.us/photo/my-images/407/screenshotfrom201206281.png/
I had the same problem while using rvm.
To resolve it you should add:
source ~/.rvm/scripts/rvm
to your ~/.bashrc
I had a very similar problem. Many of the commands of my rails environment were not working on Terminator and the following solved it for me.
Right click on the Terminator window. Preferences > Profiles > Command and check "Run command as login shell"
Please refer to the following post as to why this works https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal
Here is some more insight on shell login from RVM https://rvm.io/support/faq#shell_login
I also enconter this problem like you , rails can run on terminal but not termilator, i can't resolve it. So I use tmux instead of termilator which also can splits windows and even more stronger.
I have installed:
-Aptana studio v 3.0.9
-Ruby 192p290
-DevKit
-Git
And I was creating rails project using aptana and run the rails s command from its terminal; everything worked fine till yesterday.
I tried to do the same but I got an error when dealing with any rails commands like:
rails new .
or
gem -v
Error is:
$ rails new .
C:\Ruby192\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby192/bin/rails (LoadError)
$ rails -v
C:\Ruby192\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby192/bin/rails (LoadError)
$ gem -v
C:\Ruby192\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby192/bin/gem (LoadError)
I don't know what going on, I googled the problem and followed every instruction that could help me, but the same problem still exists.
Also I uninstalled Aptana, Ruby, DevKit and Git and reinstalled them again.
Note that the everything works fine outside Aptana so nothing wrong with the environment variables pathes, the error in Aptana itself. Also I use the instructions here.
My system is
Windows Vista
The only new thing that I did since the last time aptana was working with rails that I installed virtualbox to run ubuntu inside windows.
Any Ideas to solve the problem?
I managed to solve it by making alias for gem, ruby & rails. I found the ans here.
So All what I wrote the following commands in the terminal of Aptana:
alias ruby='C:/ruby192/bin/ruby.exe'
alias rails='C:/ruby192/bin/rails'
alias gem='C:/ruby192/bin/gem'
And it works fine now, running rails from inside aptana terminal on a windows machine.
I'm working with Xubuntu 11.04.
I do not succeed to have thin running at server startup.
when I try the command:
/etc/init.d/thin start
I get the following message:
/usr/bin/env: ruby 1.8: No such file or ...
But the commands ruby -v is working fine and the result is ruby 1.8.7 (2011-02-18 patchlevel334) Ruby enterprise
rails -v is also working fine and the result is Rails 2.3.5
If I do the command sudo thin -C configfile.yml start then the thin server is starting without any issue.
Why can't it be started with the server? What can I do to have it working?
The thin script is a usual one which is working fine on a Debian-lenny
I got the some error when using sudo gem install unicorn, and find a solution here. When ruby is not installed in the location /usr/bin/ruby, you need give a full path of ruby which means you need to use command like follows:
/full/path/to/ruby /etc/init.d/thin start
Hope this also works for you.
The header of your file should be:
#!/usr/bin/env ruby
If you include any additional arguments they should be flags for ruby itself, as others may be interpreted as a script name.
What you may have is:
#!/usr/bin/env "ruby 1.8"
Unless you have an executable named ruby 1.8 including the space, that won't work.