npm -v
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'semver' Require stack:
Before this npm -v showing 8. some version but now it's throwing error how can i resolve this or undo?
Try the below command if you are using Linux: It will clean install the latest version of npm. It will also remove the previous version of npm
sudo curl -qL https://www.npmjs.com/install.sh | sh