I just came back to work on a React project after working in the Rails environment and found that I cannot run any NPM commands in my Mac terminal. I\'ve tried all the remedies
In my case, the solution to the problem was reinstalling the node using the official installer from https://nodejs.org (Mac OS).
Solution:
P.S. The problem appeared after yarn installation.