I removed phonegap from


and installed it again using npm, now when running phonegap, I see this error:

-bash: /usr/local/bin/phonegap: No such file or directory

while phonegap is installed in


How can I fix this?

  • What's the output of which phonegap ? – Mateusz Szlosek Apr 7 '16 at 7:35
  • @MateuszSzlosek nothing, literally nothing – Reyraa Apr 7 '16 at 7:35
  • Do you have /Users/myUserName/.nvm/v5.8.0/lib/node_modules in your PATH? If not, try to add it. – Mateusz Szlosek Apr 7 '16 at 7:36
  • Or You can make a symlink in /usr/local/bin/phonegap to the existing phonegap executable. – Mateusz Szlosek Apr 7 '16 at 7:37
  • @MateuszSzlosek I have /Users/myUserName/.nvm/v5.8.0/lib/. is this enough? – Reyraa Apr 7 '16 at 7:37

I can't speak to the odd path you've installed this software into, but the reason the shell says it can't find it is that bash (and other shells) maintain a hash table with the locations of executable binaries that have been run before. The reason behind this is so that the shell doesn't have to actually search for it each time it needs to execute it.

See: http://www.gnu.org/software/bash/manual/bash.html#Command-Search-and-Execution

To force bash to re-hash the table, use 'hash -r' .


It sounds like you need to link




Step 1

In terminal, run

ls -l /usr/local/bin/phonegap

You'll probably see something like:

lrwxr-xr-x 1 jsmith wheel 36 Mar 26 12:05 /usr/local/bin/phonegap -> /some/other/path/to/phonegap

If it starts with a lowercase L then it is a link. It's probably pointing to a file that no longer exists, so you can remove it by going

rm -f /usr/local/bin/phonegap

Please be careful with rm it means "remove" or "delete" and there is no undo.

Then, you will need to make a new link from the existing phonegap to the place where it is expected to be:

ln -s /Users/myUserName/.nvm/v5.8.0/lib/node_modules/phonegap /usr/local/bin/phonegap

You do not want to add /Users/myUserName/.nvm/v5.8.0/lib/node_modules/ to your $PATH because that will eventually change. That's the whole reason to link them to a static path like /usr/local/bin/.

Note: you may need to add sudo before those commands, if you get some sort of permissions error.

(Also, sorry about the pandoc reference earlier. I had copied/pasted an actual example file from my computer and meant to change it and missed one.)

  • You will need sudo on the ln and rm commands - and did you mean pandoc? – user151019 Apr 9 '16 at 23:29
  • you may need sudo depending on /usr/local/ permissions. pandoc was a typo/copy/paste relic. Thanks. – TJ Luoma Apr 10 '16 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .