Search code examples
ubuntunpmapt-getubuntu-19.04

npm doesn't work, always throws "cannot find module semver"


As per title

Tried every solution found here on SO, also tried

sudo npm apt-get purge npm -> sudo apt-get install npm

sudo npm reinstall npm

I'm losing hope, thinking about formatting the whole pc

ubuntu 19.04, npm and node last versions


Solution

  • try with npx

    npx is a tool included with npm as from version 5.2 that makes it easy to install and run packages.

    especially command line tools like create-react-app. if you need to install a global package that is not installed in your computer running npx will download and execute the package you specified all in one command!

    the best part is that npx make sure that you always using the latest version of the package without upgrade it each time your about to use it