travis.rb icon indicating copy to clipboard operation
travis.rb copied to clipboard

Travis gets cached at wrong location?

Open mlissner opened this issue 8 years ago • 7 comments

This is a weird bug, but I can't imagine how I could have caused it, so it feels like something on your side.

After installing travis for the first time (Ubuntu 16.04):

sudo gem install travis -v 1.8.2 --no-rdoc --no-ri

And trying to run it, I got:

% travis 
bash: /usr/bin/travis: No such file or directory

Which was weird. I looked this up pretty thoroughly and nobody else seemed to have this issue except for one fairly useless blog post. Eventually, I thought that checking the location of travis might be useful, so I ran:

% which travis
/usr/local/bin/travis

Interesting. The error I'm getting is trying to run travis from /usr/bin/travis, but which thinks it's at /usr/local/bin/travis.

Turns out that bash keeps a cache of where programs are:

% type travis
travis is hashed (/usr/bin/travis)

Interesting! So I cleared it:

% hash -r

And sure enough, that fixed it:

% type travis
travis is /usr/local/bin/travis
% travis
Shell completion not installed. Would you like to install it now? |y|

My conclusion is that somehow the wrong location got cached into the bash shell during installation, because I had this problem immediately after doing the installation. Bizarre!

mlissner avatar Jun 03 '16 17:06 mlissner

I had the same issue. In my case it was because I first installed travis via apt. This will install a "trajectory analyzer and visualizer".

hansthen avatar Jul 02 '16 17:07 hansthen

Thanks for this posting this! I made the same mistake as hansthen and this solved my problem.

haydenhw avatar Dec 02 '16 17:12 haydenhw

Thank you @mlissner I face this issue after you a year :)

VietTD avatar Jun 06 '17 17:06 VietTD

Same thing happened for me, 0ct 2017.

slspencer avatar Oct 23 '17 23:10 slspencer

Am I correct to understand that this is due to the travis package being installed prior to installing the travis gem?

BanzaiMan avatar Nov 03 '18 20:11 BanzaiMan

@BanzaiMan correct, that will cause this issue.

christabone avatar Jul 11 '19 18:07 christabone

@mlissner I had the same problem, I solved it as follows hash -r that's right, without the '%'

iamlauriano avatar Apr 13 '21 06:04 iamlauriano