Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Shane Pagnatta
Shane Pagnatta
6,681 Points

Error: " module compiled against different Node.js version .... "

in File: app.js

const bcrypt = require('bcrypt'); const saltRounds = 10; const myPlaintextPassword = 'password'; const someOtherPlaintextPassword = 'not_bacon';

bcrypt.genSalt(saltRounds, function(err, salt) { bcrypt.hash(myPlaintextPassword, salt, function(err, hash) { console.log(hash); }); });

in Console:

treehouse:~/workspace$ node app.js
return process.dlopen(module, path._makeLong(filename));

Error: The module '/home/treehouse/workspace/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (module.js:682:18)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/treehouse/workspace/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)

Troubleshooting completed: npm install, npm rebuild, npm rebuild bcrypt --update-binary, npm rebuild node-pty --update-binary