Search code examples
node.jsnpmnode-gyp

How do I delete all installed/built npm C++ addons?


I upgraded my version of node. npm rebuild and deleting my node_modules directory does not seem to work for me to rebuild my C++ addons. I'm still getting this error:

Error: The module '[...]/node_modules/node-expat/build/Release/node_expat.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing

I think it would be nice to just blow away all the C++ addons (or maybe just this one if you could target them) which would likely solve my problem. Any quick and easy way to do this?


Solution

  • Node recently released version 7.7, and very soon after discovered that there was a bug in it that prevented all native modules from being compiled.

    Shortly they released a patch, v7.7.1, which should fix that issue. I'm guessing you upgraded to 7.7, so updating your install to 7.7.1 should solve this for ya.