After installing oh-my-zsh and reinstalling node and npm again, I install npm-check-updates globally and try to call 'ncu' (the npm-check-updates command). However, I get an error: zsh:
command not found: ncu
. Does anyone know how to fix this?

- 15
- 1
- 7
4 Answers
After an install you can run rehash
so zsh will analyse what new executables are available on $PATH.
Not sure if that would fix the problem, I know it fixes the missing tab completion entry after install.

- 10,693
- 5
- 42
- 42
I have corrected this problem with the following instructions:
sudo npm install -g npm-check-updates

- 11
- 2
Make sure the 'ncu' package can be found in the $PATH environment variable. Try this, to find where 'ncu' is supposed to be installed:
which ncu
If it still gives you trouble, try to see if it's in /usr/bin, $HOME/npm/bin, /usr/local/lib or /usr/sbin, and check that your $PATH environment variable contains a way to 'ncu'. Your $PATH environment variable, which can be found in
$HOME/.bashrc (Linux)
$HOME/.bash_profile (MacOS)
should look something like this:
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/npm/bin

- 123
- 2
- 10
-
Also try $HOME/npm/bin as something that $PATH should contain if it's a npm package!! – jasper Dec 25 '19 at 16:54
-
I don't think the original solution scales if I'm trying to add multiple packages. – Vincent Chee Jan 08 '20 at 20:47
-
By adding $HOME/npm/bin to path, it will include all packages installed from then on @VincentChee – jasper Jan 08 '20 at 20:48
-
I think it's `$HOME/.npm/bin`, but it possibly depends on the OS, I'm on OS X, that may be the solution for Windows? – Vincent Chee Jan 08 '20 at 20:58
-
It should be the solution for all Operating Systems. Just make sure you update .bash_profile with the correct location of the npm packages in the PATH variable. – jasper Jan 08 '20 at 21:18
FYI I am using a OSX.
The problem was that my export path
in my .zshrc
was wrong.
This was what it was previously:
export PATH=$HOME/bin:/usr/local/bin:$PATH
.
Notice there is nothing pointing at npm or any of the packages I installed globally. For anyone who has this problem in the future...
- Ensure that npm is installed and that you can still run npm commands (if not uninstall then install npm). Then run
npm -g list --depth 0
to list all your global packages. - Go into your home folder and press ⌘+Shift+. (shows all hidden files/folders), there should be a .npm folder there, ensure the packages in the list you obtained in the previous step matches what's in the
bin
folder. - Edit your
export PATH
string accordingly:
export PATH=$HOME/bin:/usr/local/bin:**$HOME/.npm/bin**:$PATH
.
This worked for me!

- 15
- 1
- 7