Node Module Version Mismatch

I was getting this error message:

module.js:597 return process.dlopen(module, path._makeLong(filename)); ^ Error: Module version mismatch. Expected 48, got 57

This normally means you have changed your version of node and a package needs recompiling to match the version of node you are running.

You can recompile from npm with:

npm rebuild

Or you can remove your node_modules and reinstall:

rm -rf node_modules

However, in my case, it was still not working after this. It turned out my problem was because I was running the npm script through Webstorm and it had its own path for node that was different to the version of node I had upgraded to.