zsh: command not found: gulp

I did sudo npm install gulp -g, typed in my password, and after installing it worked for me.


Though this is an old post, but none of the above solutions were working for me (Catalina 10.15.3). So basically issue with me wasn't about installing the gulp but not proper linking.

Commands I ran are:-

  1. npm config set prefix /usr/local

  2. npm link gulp

Hope this help anyone.


There is usually no need - and it is probably a bad idea - to set PATH to a literal value in ~/.zshrc. In doing so, you may remove some directories that have previously been added to PATH.

In your case, as it worked with another shell, I would first try to just remove the line where you set PATH as zsh should inherit PATH from its own parent environment.

If that does not add the path containing gulp (probably because it was previously added in the configuration of your old shell), you can add

PATH=$HOME/.node/bin:$PATH

to your ~/.zshrc.

Note: as PATH is already part of the environment, there is no need to export it again.


Generally, if you want to add something to PATH you can use:

PATH="/something/new/bin:$PATH"

This prepends /something/new/bin to PATH

If you really want to remove something from PATH this should do the trick:

PATH=${${PATH//\/something\/old\/bin/}//::/:}

This removes any occurences of /something/old/bin (slashes need to be escaped) from PATH and then removes duplicate colons.