简体   繁体   中英

Npm package commands stopped working after installing Homebrew on Mac

I'm using nodemon for my node.js project and wanted to install MongoDB locally on my Mac which runs Catalina 10.15.7. For that I installed the latest version of Homebrew. I started the MongoDB server sucessfully and connected to it with MongoDB compass.

After that I switched back to my nodejs project and noticed that in my zsh terminal (in Visual Studio Code) I suddenly couldn't use the nodemon command anymore. I get the error:

zsh: command not found: nodemon

I reinstalled nodemon in the project and globally too but that didn't work. I read that it's a problem with the.zshrc file so I tried to create one with the nano editor and add

echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc

but that didn't work either (I tried to replace npm-global with npm-package).

At this point I have no idea where the issue is. Any suggestions?

I don't know why but reinstalling nodemon globally with sudo worked somehow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM