I have to write sudo before running any npm command in my VS code terminal in MacBook Air (OS: macOS Sonoma 14.4). Example: sudo npm install sudo npc create-react-app my app If I didn't "sudo" the command will not execute, while others users are doing without writing sudo.
FYI: I have node.js v20.10.0 and npm version 10.2.4 installed globally in my system.
You can add it to your PATH. First evaluate the node path:
In
~/.bashrcor~/.zshrc, add the line with the evaluatednode_path:In the end, you need to restart a shell or source the file.