rake doesn't work in 2.3.0 installer #317

Open
bratsche opened this Issue Apr 23, 2016 · 8 comments

Projects

None yet

8 participants

@bratsche
$ rake
bash: /c/Ruby23/bin/rake: c:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby.exe: bad interpreter: No such file or directory

On my machine there is no user Justin, this is likely this way from the machine where the installer was built.

For me it's fixable by changing the first line of the rake command to #!/c/Ruby23/bin/ruby.exe or (because it's in my PATH) #!ruby.exe

@griest024

That fix also worked for me.

@technogeeky
erb.cmd:#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby
gem.cmd:#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby
irb.cmd:#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby
Binary file libeay32.dll matches
rdoc.cmd:#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby
ri.cmd:#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby
Binary file ruby.exe matches
Binary file rubyw.exe matches

There are other examples of this in the same directory; they are all in the .cmd (where presumably the DOS-based shell would see them), or in the binaries where I don't think they'll be visible except in error reports.

In any case, this should be patched somehow in the build process.

@Azolo
Member
Azolo commented Jul 19, 2016

Hmmm, I'll look into this.

But the full executable path has never been hard coded like that before.

@ymma
ymma commented Jul 28, 2016

Go into the bin folder of your ruby installation and edit the rake file. Change the first line from #!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby.exe to #!ruby.exe or the absolute path your ruby executable if its not in your PATH.

@aspirinor

i tried the way you guys said,but it seems didn't work on me. i changed the first line, and the alert was disappear, but the rake file still did not work.

@luislavena
Member

The issue is caused by bash using extensionless rake file instead of rake.cmd or rake.bat that are present in the same directory.

You can solve that permantly by installing gem-exefy and ensuring all executables exposed by gems are .exe.

To install perform gem install gem-exefy and then follow the project instructions:

https://github.com/bosko/gem-exefy#synopsis

The only requirement is RubyInstaller + DevKit in place and working. See the installation instructions on the wiki for the DevKit here

Remember to use the correct DevKit for your Ruby installation.

@luislavena
Member
luislavena commented Oct 8, 2016 edited

You can also workaround that by setting --env-shebang when installing any gem (gem install rake --env-shebang)

C:\Users\Luis>ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]

C:\Users\Luis>where rake
C:\Ruby23\bin\rake
C:\Ruby23\bin\rake.bat

C:\Users\Luis>type C:\Ruby23\bin\rake
#!C:/Users/Justin/Projects/rubyinstaller/sandbox/ruby23_mingw/bin/ruby.exe
#
# This file was generated by RubyGems.
...

C:\Users\Luis>gem pristine rake --env-shebang
Restoring gems to pristine condition...
Restored rake-10.4.2

C:\Users\Luis>type C:\Ruby23\bin\rake
#! ruby
#
# This file was generated by RubyGems.
...

You can apply that to all gems (gem pristine --all --env-shebang) and also make that setting permanent by updating .gemrc file in your home directory:

---
gem: --no-document --env-shebang

Hope that helps.

@swatosh
swatosh commented Oct 9, 2016

--- gem: --no-document --env-shebang

Hope that helps.

Immensely! Thanks!

Joe

@chabou chabou referenced this issue in rubygems/rubygems Jan 5, 2017
Open

Wrong shebang on Windows #1810

1 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment