Zsh: command not found: gulp

I installed zsh with homebrew and changed my shell. I had a problem trying to run the gulp command, which worked before I changed the shell to zsh.

 zsh: command not found: gulp 

A bit of research makes me realize that this has something to do with my PATH. My PATH looks like my .zshrc file.

export PATH = "/ usr / local / bin: / usr / bin: / bin: / usr / sbin: / sbin"

I want to say that I installed node with brew. How can I use gulp with zsh without returning to the default shell?

Any help is appreciated. Thanks in advance!

+7
source share
5 answers

There is usually no need — and probably a bad idea — to set PATH to a literal value in ~/.zshrc . You can also delete some directories that were previously added to PATH .

In your case, when it worked with a different shell, I would first try to simply delete the line where you set PATH , since zsh should inherit PATH from its own parent environment.

If this does not add the path containing gulp (possibly because it was previously added to the configuration of your old shell), you can add

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

to your ~/.zshrc .

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


Typically, if you want to add something to your PATH , you can use:

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

This adds /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 occurrences of /something/old/bin (slashes must be escaped) from PATH , and then removes duplicate colons.

+7
source

I did sudo npm install gulp -g , typed the password, and after installation it worked for me.

+9
source

Add $HOME/.node/bin to the path variable, i.e. add this line to your .zshrc :

 export PATH="$HOME/.node/bin:$PATH" 
+4
source

Open the .zshrs file and add this:

 export PATH="$PATH:$HOME/.rvm/bin" PATH=$PATH:/usr/local/bin npm set prefix ~/.npm PATH="$HOME/.npm/bin:$PATH" PATH="./node_modules/.bin:$PATH" 
0
source

As part of the tool: VivaGraphJS I did this and it worked:

node_modules/.bin/gulp release

and received:

 [09:56:05] Using gulpfile ~/KynKon/Sandbox/VivaGraphJS/gulpfile.js [09:56:05] Starting 'clean'... [09:56:05] Starting 'build'... [09:56:06] Finished 'build' after 923 ms [09:56:06] Finished 'clean' after 1.03 s [09:56:06] Starting 'release'... [09:56:06] Finished 'release' after 59 ms $ npm test 
-1
source

Source: https://habr.com/ru/post/985760/


All Articles