After what seems like a successful global installation of the NestJS CLI by running npm i -g @nestjs/cli, I am unable to get zsh to recognize the nest command. It always throws zsh: command not found: nest. I am working on a Macbook Pro with Big Sur v 11.6 and node v14.17.6. Any ideas at all as to why I am unable to get the command working would be very much appreciated.
1 Answer
I fixed it the following way:
- I entered
npm list -gin my terminal to check where global packages are installed.
In my case it was/Users/aleksey.malakhov/.npm-global/lib. .npm-globalcontainsbinandlibfolders.
We need/Users/aleksey.malakhov/.npm-global/binto be exposed tozsh.- I added
path+=/Users/aleksey.malakhov/.npm-global/binin my.zshrcfile, restarted terminal checkednest -vand it worked.
This topic helped me
echo PATHthis is what is spit out:/usr/local/opt/[email protected]/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/binnpm root -ggives me/Users/daviddelgadillo/.npm-global/lib/node_modules. Is this what I need to add to my $PATH?