75

I just deploy jekyll in a vps, and config git post-receive hook on it. When I push blog update to vps from my laptop, I run into this error:

remote: /usr/bin/env: ruby_executable_hooks: No such file or directory

I searched for a while, and tried the method proposed in this post: bundle update: env: ruby_executable_hooks: No such file or directory, i.e., executing the commands below:

rvm @global do gem regenerate_binstubs
gem regenerate_binstubs

But it doesn't help, the error remains. Since I'm not familiar with rvm or ruby, could anyone give me a hint?

Community
  • 1
  • 1
Nan Ma
  • 1,065
  • 1
  • 8
  • 11
  • Just ran into the same issue when pointing [Atom](https://atom.io/) to use a correct Rubocop executable. Top solution actually helped. You could probably accept the one you used, by the way :) – D-side Sep 11 '15 at 17:14

5 Answers5

179

use wrappers, example:

$ which jekyll
# /path/to/rvm/gems/ruby-version/bin/jekyll

in the returned path replace bin with wrappers so you get:

/path/to/rvm/gems/ruby-version/wrappers/jekyll

this is a script that will load proper environment and fix your problem, wrappers are generated automatically withing RVM.

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I have to agree with Dex. Was going round in circles trying to get MailCatcher to play nicely with Vagrant/PHP/Drupal and this was the key. `sendmail_path = /usr/bin/env /home/vagrant/.rvm/gems/ruby-1.9.3-p551/wrappers/catchmail`. Wrappers instead of bin! thanks. – Pebbl Jan 14 '15 at 16:03
  • it works! i was trying to schedule a backup using the backup gem. – IgnazioC Jan 18 '15 at 08:25
  • how do you exactly **replace** the path ? I guess I should not "delete" `bin`. I am using Mac. thanks – giac Jul 02 '15 at 11:50
  • 3
    it works the same on mac or linux, the path with `wrappers` includes environment, the path with `bin` - does not - so it will not know about the rest of gems – mpapis Jul 09 '15 at 08:13
  • WOW. Thank you! I cannot believe that this wasn't mentioned anywhere else. For those searching, I was attempting to setup PHPStorm to work with SCSS and needed the path `/Users/username/.rvm/gems/ruby-2.2.1/wrappers/scss` – Jerad Sep 30 '15 at 01:50
  • This really helped. But @mpapis, using RVM recently seems like bandaid after bandaid. (But maybe rvm1/ansible and Capistrano are more at fault than RVM) – dimitarvp Nov 16 '15 at 19:49
  • 1
    the same issue was always there - loading binary without proper environment - the difference is that now you can find out about it early thanks to `ruby_executable_hooks` – mpapis Nov 20 '15 at 22:19
  • 3
    Works perfect with `systemd`. Thank you. – monteirobrena May 23 '16 at 20:41
  • when I run "which jekyll", I got a blank. What should I do? – Xiaodong Qi Jun 28 '16 at 06:48
  • For me, this helped me get a command running when I wasn't logged in as my usual user. Instead, I am getting a process started up via launchctl and monit on a mac, and this worked. Thanks! – manroe Aug 20 '16 at 20:39
  • This also resolved an issue with the Atom autocomplete-ruby package, which was giving me the same error when starting Atom. – Jim Pfleger Dec 12 '16 at 16:12
  • I can't thank you enough for this. I spent a whole day trying to get my new deploy setup to work, and this did the trick. Thank you, thank you, thank you. – Maximus Oct 25 '17 at 01:55
  • Superb. Helped me a lot in setting up resque worker & scheduler using systemd – Tushar Nov 06 '19 at 19:04
  • This worked for me but only after another change. Having no jekyll I ran ´which bundle´ which returned similar path starting with ´.rvm/rubies/RUBY-VERSION´. There are no wrappers in that folder. Make sure to replace ´rubies´ with ´gems´! – zmilojko Feb 20 '20 at 05:12
  • Spent a lot of time before get to this answer, and it works perfectly – ARKhan Aug 16 '22 at 05:29
29

You need to refresh the executable-hooks to the latest version by running following command in the Terminal:

sudo gem install --user-install executable-hooks

Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
6

I had the same problem, but I have bundler, not rubygems-bundler, and my gem doesn't recognise regenerate_binstubs.

rvm all-gemsets do gem update bundler installed bundler 1.7.11 and fixed it for me.

PJSCopeland
  • 2,818
  • 1
  • 26
  • 40
3

Updating ruby gems worked for me

gem install rubygems-update
update_rubygems
cjjenkinson
  • 359
  • 4
  • 7
0

faslane env: ruby_executable_hooks: No such file or directory
re-install faslane

sudo gem install fastlane -NV
Jayxiang
  • 71
  • 3