Open manuelmeurer opened 9 years ago
The same thing just happened for passenger-enterprise-server
(not a public gem)
post_install hook at /Users/manuel/.rbenv/plugins/rbenv-gem-rehash/rubygems_plugin.rb:1 failed for passenger-enterprise-server-3.0.17
post_install hook at /usr/local/Cellar/rbenv-gem-rehash/1.0.0/rubygems_plugin.rb:1 failed for jammit-0.6.6
This has started to happen for me more often lately than before. I would imagine that rbenv rehash
is actually failing in some way. I think it might be related to https://github.com/sstephenson/rbenv/issues/759. I have Bundler set to install gems in parallel, so after reading that issue I'm wondering if that's related somehow.
This happened to me minutes ago post_install hook at /home/kinsomicrote/.rbenv/plugins/rbenv-gem-rehash/rubygems_plugin.rb:1 failed for spree_cmd-3.0.5.beta
Any solution?
I've also getting this issue but the chances of it getting solved after being open for over a year are slim I'm guessing..
Had same for private repo. Will update if find out any details
Try deleting rbenv-shim:
rm ~/.rbenv/shims/.rbenv-shim
If you ever stumble across this error here is a quick explanation what is happening and how to fix it.
After installing executables rbenv is rehashing shims by running rbenv rehash
(~/.rbenv/libexec/rbenv-rehash
). By default bundle install
is using --jobs
option set to the number of available processors.
Because bundle is installing gems in parallel, rbenv rehash
may run in the same time for two gems leading to a race condition. Normally it wouldn't be a problem because rbenv will never run twice due to the lock file it creates in ~/.rbenv/shims/.rbenv-shim
. Unfortunately the code for doing so looks like this:
set -o noclobber
{ echo > "$PROTOTYPE_SHIM_PATH"
} 2>| /dev/null ||
{ if [ -w "$SHIM_PATH" ]; then
echo "rbenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists"
else
echo "rbenv: cannot rehash: $SHIM_PATH isn't writable"
fi
exit 1
} >&2
set +o noclobber
The noclobber
option means that bash will not let you redirect to the existing file with >
. If the file exists it will go straight to the if
conditional to decide which message to display AND THEN it will exit with exit code 1.
Post install hook will interpret it as an error while installing a gem.
THE SOLUTION
You either:
-j1
which is slower but will not lead to a race condition because it will only use one thread.~/.rbenv/shims/.rbenv-shim
change exit 1
to exit 0
. Not ideal but it works. For CI you can do it easily with sed
by running:sed -i.bak 's/exit 1/exit 0/g' ~/.rbenv/libexec/rbenv-rehash
When I run
bundle install
with thesdoc
gem in my Gemfile, I get this error:I guess it's because the gem executes
git
when checking forexecutables
: https://github.com/voloko/sdoc/blob/087940a7220b523a3a3758479552fcf81329b320/sdoc.gemspec#L37Replacing this line with a simple array of the executables would probably fix this, but is there any other way to make this work properly?