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, this happened after I performed a machine-wide clean-up of all node_modules folders. I had node installed with nvm and I started getting this error, no matter what node-related action I wanted to trigger:
Error: Cannot find module '../lib/utils/unsupported.js'
I solved it by doing the following:
brew uninstall --force node
/usr/local/lib/node_modules
folderbrew install node
None of the other answered solved my issue. After reinstalling Node, I still got the same error (even when I just wrote npm -v
).
I followed this answer here (removing everything called node and npm), which solved it for me.
I'm sorry, but in my case I get the same error, because, my index.js is inside de src folder, make sure that you are in the seme directory of your index.js to run
I had the same error after brew upgrade
on mac.
I did brew postinstall node
and that fixed it.
This happened to me after installing yarn.
in a terminal:
brew uninstall --force --ignore-dependencies node
brew install node
if you have trouble symlinking node, in the same terminal:
sudo chown -R `whoami`:admin /usr/local/include
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/lib
brew link --overwrite node
Check that your re-installation worked by typing the following in the terminal:
node -v