Friday 21 April 2017

Node.js native modules on windows compiled against wrong node version without recompiling?

Running Node.js 6.10.2 on Windows 10. I'm working on a project that uses a couple native modules, in particular event-loop-stats and bcrypt. I have installed node-gyp and the windows-build-tools packages. I have also got a couple different versions of Visual Studio (in specific VS 2013 & 2015) installed. My npm install works with no build errors from the native modules.

However, I've gotten into this weird state where after I log out and log in again, when I try to run my test suite I get this:

[10:38:16] Error in plugin 'gulp-mocha'
Message:
    The module '\\?\D:\Dev\project\node_modules\event-loop-stats\build\Release\eventLoopStats.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).

I eventually get it working again by clearing my NPM cache, running vsvars32, and deleting node_modules and redoing npm install. But it inevitably comes back the next morning.

Any ideas what can be causing this? I don't see other versions of node in my path anywhere, I'm always using the same version of VS... I'm at my wits end.

Anyone got any ideas why I get this?



via Chris Tavares

No comments:

Post a Comment