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 trialDamir Kotorić
11,656 PointsBoth 'npm install bcrypt' and 'npm install bcrypt --python=python2' doesn't work in Workspaces.
The error message I'm getting:
treehouse:~/workspace$ npm install bcrypt
bcrypt@1.0.2 install /home/treehouse/workspace/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.
0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.9.4 (node-v48 ABI) (falling bac
k to source compile with node-gyp)
make: Entering directory /home/treehouse/workspace/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
COPY /home/treehouse/workspace/node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory
/home/treehouse/workspace/node_modules/bcrypt/build'
/home/treehouse/workspace
└── bcrypt@1.0.2
npm WARN enoent ENOENT: no such file or directory, open '/home/treehouse/workspace/package.json'
npm WARN workspace No description
npm WARN workspace No repository field.
npm WARN workspace No README data
npm WARN workspace No license field.
7 Answers
Josh Campbell
4,038 PointsI was getting the same errors, I continued the tutorial to see if it would work anyway and it does. For some reason my node_modules folder has many more subfolders in it that I don't think are in use, but the bcrypt folder is in there with all the required files.
Patrik Horváth
11,110 PointsHi Andrew Chalkley , any passible fix for workspace ? it doesnt works
also when i opened node_modules i have here about 100 + Folders .... and he got just one =\
npm WARN enoent ENOENT: no such file or directory, open '/home/treehouse/workspace/package.json'
npm WARN workspace No description
npm WARN workspace No repository field.
npm WARN workspace No README data
npm WARN workspace No license field.
Xiaoxuan Wang
4,590 PointsSame question here, failed to install npm on workspace.
jlampstack
23,932 PointsIs there a treehouse moderator who can answer this problem for us? I'm having the same trouble too.
Serge Zant
10,420 PointsAlso having trouble installing bcrypt. Please help us out here.
Bob Swaney
13,010 PointsSo I was having the same issues...Whenever I would try what andrew was doing .... npm install bcrypt --python=python2, it would NEVER work..i actually broke my workspace trying different things and had to delete it and relaunch workspace...however, I did find a fix...using methods from the next 'chapter' of this lesson... To fix, I typed in the console... npm outdated ... I was given a list, with bcrypt listed as 'current' version 0.8.3, and 'wanted' version 0.8.7...so i went to the package.json folder...found the key with bcrypt listed, and changed the version to "0.8.7" with no symbol in front of it, saved the file, and then ran npm install again to update it to the version wanted...then launched node app.js and i saw the hashed password...hope this helps!
James Churchill
Treehouse TeacherIf you are getting errors in the console while installing bcrypt, run npm install bcryptjs
instead. Then require bcryptjs
in app.js. For example:
var unsecurePlainTextPassword = "password";
var bcrypt = require('bcryptjs');
bcrypt.genSalt(10, function(err, salt) {
bcrypt.hash(unsecurePlainTextPassword, salt, function(err, hash) {
console.log(hash);
});
});
bcryptjs is optimized bcrypt in JavaScript with zero dependencies.