I recently updated a nodejs executable using npm and now the executable is pointing to the wrong location. when I run the which command in terminal it is pointing to the old no
I don't think which
ever returns something that doesn't exist. It shows you which version of the executable is being found, based on the search order in your $PATH
environment variable.
This $PATH
variable is set in your shell. Type $PATH
in the terminal to see what your path variable is set to. (Probably something like /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
)
See this question for some instructions to change your shell path variable: Set environment variables on Mac OS X Lion
Can you give more specific examples of where this stuff is, and what files you are looking at, because I don't think your description makes sense (with regard to "pointing to the old non-existant location")?
bash caches the paths to executables you've run. You can reset the cache with "hash -r" (or start a new bash session or terminal).