Search code examples
ruby-on-railsrubywindowsgit

Why am I getting a 'No such file or directory' error when attempting to run 'rails s' in Git Bash on Windows?


there. I am working on a project in a small team, our app is build on the ruby on rails, I am Front End Developer and do all React stuff, but recently we updated version of ruby to the latest one, rails also. And after that I can not even start an app in Git Bash with rails s.

I work on Windows machine, and all commands with ruby, rails works perfect in Power Shell, but in Git Bash I can not even simply check the version of rails. All the time I get this error:

/c/Users/MyName/AppData/Local/Microsoft/WindowsApps/rails: line 6: /c/Users/MyName/AppData/Local/Microsoft/WindowsApps/ruby: No such file or directory

Please, anybody who knows how to fix it, answer me. Thanks

I do not understand what is the problem, reinstalled ruby and git few times, but nothing works. I can start an app and work with a project from Power Shell, but it is harder for me, than just use Git Bash from VS Code


Solution

  • I guess when you installed Ruby, you changed the Ruby's install path. You can edit it here:

    /c/Users/MyName/AppData/Local/Microsoft/WindowsApps/rails
    

    line 6. Update to your real ruby install path

    For example, when I executed the command jekyll server, the same problem occurred. I edit the file

    C:\Users\MyName\AppData\Local\Microsoft\WindowsApps\jekyll
    

    from

    exec "${binpath}/ruby" "-x" "$0" "$@"
    

    to

    exec "D:/Program/develop/Ruby32-x64/bin/ruby" "-x" "$0" "$@"