I am using reactjs and am unable to install any packages using npm install
. The error message I\'m getting is :
npm ERR! Cannot read property \'reso
The reason for the error was probably conflicting global packages and node versions. I uninstalled node and npm and then reinstalled them.
To remove nodejs and associated packages (like npm):
sudo apt-get purge --auto-remove nodejs
Nodejs and npm will leave files in the system which may cause issues during reinstallation. I had to remove them as well.
Although it is a bad practice to remove packages manually (it may cause problems with the package manager), it helped my case. This answer shows how to remove nodejs and related files manually.
To reinstall them:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm