Ruby rails error Invalid Switch - ruby-on-rails

ashamed to say, i got home decided to follow a tutorial and got stuck very early on. I'm running rails 3.1.1 on windows and attempting the tut from http://guides.rubyonrails.org/getting_started.html
If you look at 4.2 it tells us to run a command: $ rm public/index.html - which in windows i think is just in cmd type cd blog and then its just erase public/index.html
But i get the error returned: Invalid Switch "index.html".
Anyone who can shed some light i would be much appreciative. I can't beleive im stuck already!
Thanks
M

Your problem is that in windows you have to use backslash instead of slash in unix-like systems. Use erase public\index.html

Related

Ruby On Rails Installation Mac OS X Bundler GemFileNotFound

I'm using Mac OS X Sierra and following Daniel's Setup Article to install Ruby on Rails. All goes well until I get try to confirm the Rails version, I get errors saying it can't locate several files. Here's a screenshot of the console output for the last couple of steps:
After the first attempt, I imploded rvm, removed all traces from .bashrc, .bash_profile, and .profile, and started from the beginning. I hit the same issue at the same point in the process. If any further information would be useful, please let me know and I'll be glad to modify. Just in case it has something to do with $PATH, I'll put the echo $PATH output below:
/Users/john/.rvm/gems/ruby-2.4.1#rails5.1/bin:/Users/john/.rvm/gems/ruby-2.4.1#global/bin:/Users/john/.rvm/rubies/ruby-2.4.1/bin:/Users/john/.rvm/bin:/usr/local/bin:/usr/bin:/usr/local:/bin:/usr/local/sbin:/sbin:/Users/john/bin:/usr/local/mysql/bin:/usr/local/opt/openssl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin
Thanks in advance for any suggestions.
[edit] Not having had any replies and having spent an entire day trying to get it running locally, I decided to try an online environment with cloud9. I was up and running on cloud9 in 15 minutes without any issues, and that includes creating the account. I would still like to know if anyone has any ideas about the rvm local version, so I'll leave the question for now. [/edit]

subl: command not found

I'm a newbie trying to train my self using ruby on rails. I am trying to follow an instruction where I am require to type in "subl Gemfile" on Git Bash but it constantly keeps showing 'sh.exe": subl: command not found'. Kindly advice the way forward.
P/S: I am a beginner in programming
go to the directory where you're creating your RoR app.
suppose you're creating your app at
/Users/LocalUser/workspace/YourApp
Then, there typing subl Gemfile would work
first type pwd in your command terminal and check where are you right now
also if you're running it from there, then try following link solution
https://danlimerick.wordpress.com/2014/01/07/git-for-windows-tip-opening-sublime-text-from-bash/

Ruby on Rails - Windows 7 installation, non-english characters in user name

I'm trying to install Ruby on Rails on Windows 7 but I have a problem immediately at the beginning of the configuration. This is the first time I'm trying RoR.
I downloaded RailsInsaller from http://railsinstaller.org/ and installed it successfully. Immediately after the installation when I need to configure environment, I receive an error in cmd:
# Rails Environment Configuration.
open C:\\Users\\\246ero/.ssh/id_rsa failed: No such file or directory.
The system cannot find the path specified.
D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `initialize': No such file o
r directory - C:\Users\|ero/.ssh/id_rsa.pub (Errno::ENOENT)
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `open'
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `<main>'
What is the solution to this problem? Or is there any other way to install RoR on Windows 7? Thank you for your help.
I know it's an old post, but I had the same issue, and I think I've found the solution.
The path that ssh is trying to access contains that character "|" that Ruby doesn't like, that's because your username is "|ero".
To resolve this issue, you should either change your windows username (this should prevent you from a lot of troubles in your future setup), or change your HOME environment variable so that it points to a folder that doesn't contain any accent, space or strange character in its path ! And then re-install Ruby :)
Hope it helps!
I have installed Ruby on Rails in Windows 7. To install ruby on rails on Windows7 follow the steps:
1) install ruby on windows 7. Download from: http://rubyinstaller.org/
2) check ruby is installed correctly by this command ruby -v if this gives command not found error, then set RUBY_HOME="path/to/ruby/bin" in environment variables.
3) install rails by command gem install rails.
and you are done. Enjoy Ruby On Rails on Windows7.
I faced exactly the same problem and found its solution - under Windows XP Pro SP3. You should manually generate the ssh keys pair. Run ssh-keygen from a bash
shell so it generated both id_rsa and id_rsa.pub.
That's easy as 3 mouseclicks:
Start - Programs - Rails Installer - Git Bash
type there "ssh-keygen". Press Enter 2 or 3 times. You're done! The problem is gone now.

Ruby on Rails Bash Profile Issue

I'm trying to learn to use Ruby on Rails (going through Hartl's tutorial for 3.2) and I'm trying to get some command line tools to work from the command prompt in Terminal. In this particular example I'm trying to get Sublime Text 2 to work. Everything is setup, but when I run subl --help, for example it returns
-bash: subl: command not found
I followed all the directions in this link - http://www.sublimetext.com/docs/2/osx_command_line.html
and I also used Stack Overflow to try to figure out how to solve this error and it seems to be a bash profile problem, but I don't know how to access, or modify this profile to get things working. Can you offer any help?
Thanks!
If you're using OSX Lion, you may not have a .bash_profile file. Use the answers to this question for help in creating/using one, and then put the exports suggested by the howto at sublimetext.com in it.

The system cannot find the path specified when starting Ruby and Rails command prompt

I just started learning rails a week ago and everything worked until today. Now when I start the Ruby command prompt, it says:
The system cannot find the path specified.
# Under Rails Environment Configuration.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
---
The paths for ruby and rails show up correctly.
I'm using Windows Vista 32-bit. Any help would be greatly appreciated, thanks!
You've probably used "Ansicon" - a program to get the colors in windows prompt right. If you installed it permanently with -i parameter and consequently moved/deleted its directory, it would lead to this error. (I've just experienced it)
The solution is to renew the location of the ansicon data files or to remove the following registry entry:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
You can find more on this issue at http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/
Good luck!
I had the same problem in Windows 7 and solved it by adding Git/bin directory to the system path variable (found the answer here). Hope this helps someone!
None of the answers above helped me. My issue was whenever i typed rail -v it gave me the same error. I had to install rails, i used the following command:
gem install rails --no-document
you can check out the following installation steps to get around the error:
http://docs.railsbridge.org/installfest/windows

Resources