Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails - The system cannot find the path specified #73

Closed
askeroff opened this issue Feb 22, 2016 · 35 comments
Closed

Rails - The system cannot find the path specified #73

askeroff opened this issue Feb 22, 2016 · 35 comments

Comments

@askeroff
Copy link

I have installed rails and ruby with railsinstaller. The problem is, when i run rails command, it gives me: "The system cannot find the path specified."

I am running windows 7 x64. Ruby 2.20

Tried uninstalling rails and installing it againt, does not help. Ruby commands executes like "ruby -v", "rails -v" doesn`t work.

Have googled,didnt find solution for windows, that worked. I have uninstalled it and installed it, I dont know whats happening.
Ruby is in an environment path, so it executes rails with "rails -v", but gives me that message.
Someone help, please.

@j54n1n
Copy link

j54n1n commented Feb 22, 2016

I encountered the same problem. I used the latest railsinstaller version 3.2.0 and I discovered that in the install path C:\RailsInstaller\Ruby2.2.0\bin some of the batch (*.bat) files contained a wrong path.
Instead of the string @"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" the files should contain something like @"%~dp0ruby.exe".

A temporary fix is to replace any string containing @"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" with @"%~dp0ruby.exe" after the line with :WinNT.

@askeroff
Copy link
Author

@j54n1n , wow, changing path inside batch file worked. Did not know, I could do that. Been struggling with it whole day.Thanks a lot.

@emachnic
Copy link
Contributor

Closed at dup of #70

@aheshan
Copy link

aheshan commented Mar 19, 2016

This helps me too on windows. The path was incorrect in bath file.

@BelieveC
Copy link

BelieveC commented Apr 3, 2016

Thanxxx... A lottt! Saved a loottt of time

@priyanshAgarwal
Copy link

@j54n1n "some of the batch" can you explicitly define the batch files which require change.

@hope2332
Copy link

hope2332 commented Apr 5, 2016

Thanks j5414, that did the trick for me and I only had to spend 10 minutes doing it!

@JP-x
Copy link

JP-x commented Apr 13, 2016

@priyansh1990

From what I determined sadly, was that you have to go through each of the batch files within the C:\RailsInstaller\Ruby2.2.0\bin directory.

In my case I went to bundle and bundler batch files since they were the commands that were not working.

@jayantbh
Copy link

I opened all the files under C:\RailsInstaller\Ruby2.2.0\bin in Sublime Text, and replaced with Ctrl+Shift+F,
This
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe"
with this
@"%~dp0ruby.exe"
across all files that had a match.

Took only a couple of seconds. This might help someone who stumbles across it after me.

@ziezam
Copy link

ziezam commented Jun 14, 2016

thanks , its work

@zegao96
Copy link

zegao96 commented Jun 20, 2016

@jayantbh thanks a lot, it really saves my time!

@susantabiswas
Copy link

thanks a lot!!

@vinaymopidevi
Copy link

great thank you

@vinaymopidevi
Copy link

updated rails.bat

@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"%~dp0ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

@deepankar30052
Copy link

Solved the problem . Thanks

@ArthurZ
Copy link

ArthurZ commented Sep 28, 2016

It is still a problem, just saying please do not give up on Windows users.

@emachnic
Copy link
Contributor

I don't know how to fix this. If anyone knows a Windows dev who might be
able to help, it would be much appreciated.

Evan
On Tue, Sep 27, 2016 at 9:09 PM Arthur [email protected] wrote:

It is still a problem, just saying please do not give up on Windows users.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#73 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKUOi5kFKGJDrrOYuAHRoHMhziwhiSkks5qucxRgaJpZM4Hfa0D
.

@RyanSpears
Copy link

The solution by vinaymopidevi solved the problem for me too.

@Mortecha
Copy link

Solved the problem. Is there no way to fix this?

@SaqlainHussainShah
Copy link

where could i find my .bat file?

@thanhquang1988
Copy link

it work. thanks
I opened all the files under C:\RailsInstaller\Ruby2.2.0\bin in Sublime Text, and replaced with Ctrl+Shift+F,
This
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe"
with this
@"%~dp0ruby.exe"
across all files that had a match.

@ninoM
Copy link

ninoM commented Oct 21, 2016

Just replacing it with this:
@"%~dp0ruby.exe"
didn't work for me. rails -v was working for me though and it was "bundle install" that wasn't working so I went into rails.bat and copied the line below :WinNT and this is what I found
@"C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*

which I copy pasted to the bundle.bat and bundler.bat and it worked! Hope this helps someone else.

@ghost
Copy link

ghost commented Oct 22, 2016

Worked for me! Thanks heaps!

@webdril
Copy link

webdril commented Nov 6, 2016

@jayantbh you really saved me...God bless you,your effort and others in this room

@valkyrea
Copy link

Worked for me, as well!!! Thank you!!!!!!

@mixelpixel
Copy link

mixelpixel commented Nov 15, 2016

Sorry, but I know nothing of Windows batch files (*.bat).

Instead of this:
@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/bundle" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*

Do we want this:
@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"%~dp0ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

or

@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"%~dp0ruby.exe" "%~dp0ruby.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

or

@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

@mixelpixel
Copy link

I also ask because in addition to the ruby.exe installed from http://railsinstaller.org/en
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
installed at C;/RailsInstaller/bin/

I also have more recent ruby.exe from http://rubyinstaller.org/downloads/
ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
installed at C:/Ruby23-x64/bin/
and need to use it in conjunction with gems that require this newer version.

Will I need to also modify the .bat files in Ruby 2.3.?

Of note, there are only two:
setrbvars.bat
rake.bat

and rake.bat read:
@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

@giathanhphat
Copy link

giathanhphat commented Nov 23, 2016

it's work. Thank so much, jayantbh.

@sundoze
Copy link

sundoze commented Dec 14, 2016

Go into C:\RailsInstaller\Ruby2.2.0. Change all contents in the .bat files from this:
@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/tilt" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*

Delete that and paste in the text below:

@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

@RyanSpears
Copy link

Not sure if anyone is interested, but I did not have to worry about any of the above when I followed the following to install ruby and rails on Windows. http://railsinstallfest.org/guides/installfest/rails_on_windows/

@anakinsam
Copy link

anakinsam commented Dec 19, 2016

try to reinstall rails
using command
c:\sites>gem install rails

@ExpressyCode
Copy link

Thanks alot!

I opened C:\RailsInstaller\Ruby2.3.0\bin\rails.bat with Sublime Text and replaced all @"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" with @"%~dp0ruby.exe" works perfect now.

@JenerikMind
Copy link

Used vinaymopidevi's updated Rails.bat, re-ran the batch file and fixed it up in a jiffy. Fantastic.

@Adilkemo
Copy link

fixing rails problem on windwos 7, 8, 10:

I have been faced a lot of problems while I'm trying to run rails on my system, I try many solutions to solve, but all comes under failed. So, now I got one solution work good on my system, I recommend you to try this with steps it may can help you too.

Download the "rubyinstall" and run on your System, Then Download "Devekite" for ruby extract on folder “C:\RubyDevKit“ after you do this.

Now come to Command ruby type:
C:\Users>cd..
C:>cd C:\RubyDevKit
C:\RubyDevKit>chcp 1252
C:\RubyDevKit>ruby dk.rb init
C:\RubyDevKit>ruby dk.rb install
C:\RubyDevKit>gem install rails --version 5.0.0
C:\RubyDevKit>rails -v
C:\RubyDevKit>cd..
C:>cd [folder_name]
C:[folder_name]>rails new sample_app
C:[folder_name]>bundle install
C:[folder_name]>rails server or rails s

@nabucodonosor7
Copy link

muchas gracias me ayudaron muchisimo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests