Turns out that bash has cache…

All developers, whether they like to admit it or not, will at times waste a huge amount of time trying to figure something out that has seemingly no explanation – and it turns out to just be a caching issue. This terribly common with front end web development.

Today I was installing Node.JS on a server directly from source but made a mistake. I figured, no problem, I’ll just uninstall and reinstall correctly. But the command node --version was returning an error – /usr/local/bin/node: No such file or directory.

After trying to install a million different ways, creating symlinks, and searching high and low for orphaned files… it was a simple caching issue.

Linux bash caches paths of executables. The fix is simple.

hash -d package removes the cache for a specific entry, while hash -r dumps the entire thing.

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz