With modern shells they remember the path to a command you previously ran. So, for example:
bash-4.2$ hash
hash: hash table empty
bash-4.2$ whoami
sweh
bash-4.2$ hash
hits command
1 /usr/bin/whoami
Now if you remove a program (in your case /bin/protoc) and install it in a new location (/usr/local/bin/protoc) the current shell will try the old location. And it fails, because the old file isn't there.
You can tell the shell to forget all remembered paths with hash -r.
That will force it to search the path again.
The which command doesn't understand the current shell's hash. The type command is a shell builtin that's more accurate.
type protocsay?protoc is hashed (/bin/protoc)/bin/protocbut removed it. So tryhash -r. That will causebashto forget the old name and look on the path again.