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

rake doesn't work in 2.3.0 installer #317

Open
bratsche opened this issue Apr 23, 2016 · 13 comments
Open

rake doesn't work in 2.3.0 installer #317

bratsche opened this issue Apr 23, 2016 · 13 comments
Labels

Comments

@bratsche
Copy link

$ 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
Copy link

That fix also worked for me.

@technogeeky
Copy link

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
Copy link
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
Copy link

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
Copy link

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
Copy link
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
Copy link
Member

luislavena commented Oct 8, 2016

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
Copy link

swatosh commented Oct 9, 2016

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

Hope that helps.

Immensely! Thanks!

Joe

@wycats
Copy link

wycats commented Apr 17, 2017

@luislavena does it maybe make sense to make the above ~/.gemrc the default for oneclick installer?

@luislavena
Copy link
Member

@wycats I think is possible using operating_system.rb RubyGems hook, but that will need confirmation.

@Azolo
Copy link
Member

Azolo commented Apr 17, 2017

@luislavena @wycats This is only happening with prepackaging rake. So even if you made it the default the problem would persist unless it was fixed during packaging. Installing/reinstalling rake or using gem pristine rake should just fix it.

Interestingly enough all the other prepackaged binaries use #!/usr/bin/env ruby. I think this is either a patched when packaging or Ruby issue. rake is being treated differently from the other gem binaries that are shipped with ruby though.

@Azolo
Copy link
Member

Azolo commented Apr 17, 2017

@luislavena Also the way to set the defaults in operating_system.rb (from the best that I can tell) is like this:

Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.merge!({'gem' => '--env-shebang'})

But any configuration in your .gemrc seem to overwrite those default configs.

@larskanis
Copy link
Member

larskanis commented Apr 18, 2017 via email

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

No branches or pull requests

10 participants