Search code examples
terminalzshoh-my-zshzshrc

correcting $PATH so I can use NPM packages commands on MACOS with ZSH


echo $PATH says :

echo $PATH
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

When I run npm command, I get info and I can install packages. I run

npm install npm-check-updates

When I go for npm list

npm list
username@ /Users/username
├── g@2.0.1
├── gatsby-plugin-sitemap@2.12.0
└── npm@8.17.0

But when I go for

which ncu
ncu not found

ncu -u
zsh: command not found: ncu

I tried to edit .zhrc acordingly to accepted answer in 59480260, but it does not help at all. I guess the homebrew is my blocker?

Thank you for help! Im kind of lost in this PATH configurations


Solution

  • You need to install this way:

    npm install -g npm-check-updates
    

    That creates the file /opt/homebrew/bin/ncu for you.

    Your path looks fine, as it contains /opt/homebrew/.

    ncu should be in /opt/homebrew/bin:

    % file /opt/homebrew/bin/ncu
    /opt/homebrew/bin/ncu: a /usr/bin/env node script text executable, ASCII text
    

    Of note, it is .zshrc not .zhrc.