Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript npm Basics Installing Packages with npm Installing Local Packages

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
module.js:682
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