I just downloaded node but npm is not working. whenever I use a npm comman I get Error: cannot find module \'strip-ansi\'.
It solved for me by going to the NPM install folder at /usr/local/lib/node_modules/npm and running the yarn command. After running it successfully, NPM started working normally.
/usr/local/lib/node_modules/npm
yarn