Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Why is my system only looking in /snap for binaries?

Writer Olivia Zamora

I tried to use snap to install node. The package was stale. So, I snap remove'd that, and I installed node via apt from the nodesource PPA. Great:

$ node -v
v14.15.5

However, when I try to use npm, I get the following error:

$ npm
bash: /snap/bin/npm: No such file or directory

This is weird to me, since /usr/bin is on my $PATH and:

$ ls /usr/bin/npm
/usr/bin/npm

What has snap done to my system's normal method of looking for binaries in $PATH?

Also, how do I fix this?

3

1 Answer

Your shell doesn't constantly search for binaries once it's found one-- to do so would be a waste of time in most cases. It caches the result. That bites hard if you end up removing a binary after it's already cached where it found it, though.

You can fix this by simply starting a new shell, or clearing the cache in an existing shell with hash -r.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy