node.js - Error: Cannot find module '../lib/utils/unsupported.js' while using Ionic

ID : 10249

viewed : 14

Tags : node.jsionic-frameworkionic2node.js

Top 5 Answer for node.js - Error: Cannot find module '../lib/utils/unsupported.js' while using Ionic

vote vote

97

Try to remove /usr/local/lib/node_modules/npm and reinstall node again. This should work.

On MacOS with Homebrew:

sudo rm -rf /usr/local/lib/node_modules/npm brew reinstall node 
vote vote

86

I followed the previous answers and reinstalled node. But I got this error.

Warning: The post-install step did not complete successfully You can try again using brew postinstall node

So I ran this command

sudo chown -R $(whoami):admin /usr/local/lib/node_modules/ 

Then ran

brew postinstall node 
vote vote

72

I received a similar error and now have it working.

First make sure you have the latest version

brew update 

Remove your previous instance of node:

brew uninstall node 

Then reinstall the latest version:

brew install node 

And then make sure it is symlinked into /usr/local if it isn't already. You would get an error to let you know to complete this step.

brew link --overwrite node  

More details on how to install/upgrade node are also available.

vote vote

66

On Mac OS X (10.12.6), I resolved this issue by doing the following:

brew uninstall --force node brew install node 

I then got an error complaining that node postinstall failed, and to rerun brew postinstall node

I then got an error:

permission denied @ rb_sysopen /usr/local/lib/node_modules/npm/bin/npx 

I resolved that error by:

sudo chown -R $(whoami):admin /usr/local/lib/node_modules 

And now I don't get this error any more.

vote vote

56

If you are using "n" library @ https://github.com/tj/n . Do the following

  echo $NODE_PATH 

If node path is empty, then

sudo n latest    - sudo is optional depending on your system 

After switching Node.js versions using n, npm may not work properly.

curl -0 -L https://npmjs.com/install.sh | sudo sh echo NODE_PATH 

You should see your Node Path now. Else, it might be something else

Top 3 video Explaining node.js - Error: Cannot find module '../lib/utils/unsupported.js' while using Ionic

Related QUESTION?