6

I'm working through Michael Hartl's tutorial trying to learn Rails for the first time, and I've run into some issues. I recently reinstalled the whole Rails Installer because I had apparently inadvertently deleted some important files. Now, when I try running a test I get the following error:

sh.exe": /c/Program Files (x86)/ruby-1.9.3/bin/bundle: "c:/Program: bad interpre
ter: No such file or directory

I checked my PATH and attempted to use the solution outlined here: Bundle command not found. Bad Interpreter ..but putting quotation marks around "C:\Program Files (x86)\ruby-1.9.3\bin" didn't do anything for me.

I ran $ rails -v and got the following output:

$ rails -v
←[31mCould not find multi_json-1.3.6 in any of the sources←[0m
←[33mRun `bundle install` to install missing gems.←[0m

So then I tried running $bundle install and got the following issue again:

Tom@TOM-PC /c/sample_app (updating-users)
$ bundle install
sh.exe": /c/Program Files (x86)/ruby-1.9.3/bin/bundle: "c:/Program: bad interpre
ter: No such file or directory

I'd really appreciate any help -- I've spent 5+ hours today trying to get back on track and am still at a loss. Please let me know if I'm missing any pertinent info -- Thanks!

Community
  • 1
  • 1
tomfooleryu
  • 61
  • 1
  • 4

1 Answers1

4

You need to open this file /c/Program Files (x86)/ruby-1.9.3/bin/bundle and see, what interpreter is specified there. Probably it is something like /c/Program Files (x86)/ruby-1.9.3/bin/ruby. You need to write \ before all spaces in the path (or the part with spaces) or put entire path in the doblequotes:

/c/"Program Files (x86)"/ruby-1.9.3/bin/ruby
Igor Chubin
  • 61,765
  • 13
  • 122
  • 144
  • Thanks for the quick response Igor -- I just checked /c/Program Files (x86)/ruby-1.9.3/bin and there's actually no bundle file there -- does this mean Ruby wasn't installed correctly/fully? Any suggestions on fixing this? – tomfooleryu Jul 03 '12 at 21:30
  • No! You have `bundle`! Check it once again! You must edit the first line in the file. But file exists! You see the messages that are created while running the file – Igor Chubin Jul 03 '12 at 21:33
  • I just took this picture to show the contents of my bin folder (http://imgur.com/VRUt4) -- any idea why it wouldn't be there/what I should do next? – tomfooleryu Jul 03 '12 at 21:37
  • you are right, I don't see here many files that must be here. what show `which bundle`? – Igor Chubin Jul 03 '12 at 21:41
  • Well this is weird: $ which bundle /c/Program Files (x86)/ruby-1.9.3/bin/bundle – tomfooleryu Jul 03 '12 at 21:43
  • the file exists. can you try to show its first line: `head -1 "/c/Program Files (x86)/ruby-1.9.3/bin/bundle"` ? – Igor Chubin Jul 03 '12 at 21:45
  • Here's what I got: $ head -1 "/c/Program Files (x86)/ruby-1.9.3/bin/bundle" #!"c:/Program Files (x86)/ruby-1.9.3/bin/ruby.exe" – tomfooleryu Jul 03 '12 at 21:47
  • I see the quotes. it is good. It's strange but the two directories `"/c/Program Files (x86)/ruby-1.9.3/"` and `"c:/Program Files (x86)/ruby-1.9.3/bin/"` seems to be different. can you check it with `ls`? – Igor Chubin Jul 03 '12 at 21:50
  • Tom@TOM-PC /c/sample_app (updating-users) $ ls "/c/Program Files (x86)/ruby-1.9.3/" bin lib Tom@TOM-PC /c/sample_app (updating-users) $ ls "c:/Program Files (x86)/ruby-1.9.3/bin/" bundle rackup rake2thor.bat schema sequel.bat thor foreman rackup.bat restclient schema.bat taps thor.bat foreman.bat rake2thor restclient.bat sequel taps.bat – tomfooleryu Jul 03 '12 at 21:52
  • Also I went back and tried to get the first line for the file since the ls showed the bundle under the C: ruby directory and here's what I got as a result -- any suggestions for next steps? $ head -1 "/c:/Program Files (x86)/ruby-1.9.3/bin/bundle" head: /c:/Program Files (x86)/ruby-1.9.3/bin/bundle: No such file or directory – tomfooleryu Jul 03 '12 at 22:12
  • Hello, I am facing a similar issue. The first line of my ruby file is `#!"C:/Program Files/Ruby25-x64/bin/ruby.exe"` and I still get the error: ` bash: /c/Program Files/Ruby25-x64/bin/bundle: "C:/Program: bad interpreter: No such file or directory` I believe that it is not reading beyond the space in "Program Files" although the entire string is in double quotes. – thegreatcoder Jan 28 '19 at 21:54