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

JavaScript User Authentication With Express and Mongo Sessions and Cookies Working with Sessions in Express

Jef Davis
Jef Davis
29,162 Points

Bcrypt deprecated?

I'm getting a long series of errors when running 'npm install' that occurs when installing bcrypt:

npm WARN deprecated bcrypt@0.8.7: bcrypt < v2.0.0 is susceptible to bcrypt wrap-around bug. Upgrade to bcrypt >= v2.0.0 for improved support for newer bcrypt hashes

.... 

gyp ERR! node -v v10.4.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Installing bcrypt 2.0.0 doesn't fix this issue. Has anyone had a similar problem?

I've been able to install and use bcryptjs with no problems, but that of course doesn't help me follow along with the videos as easily.

Ryan Emslie
seal-mask
.a{fill-rule:evenodd;}techdegree
Ryan Emslie
Full Stack JavaScript Techdegree Student 14,453 Points

I was having the same issue when trying to follow along with the videos. I was able to get it working by running 'npm install --save bcrypt@~2'. I will probably look into bcryptjs moving forward but at least I can now follow along with the videos.

2 Answers

mulgey
mulgey
9,899 Points

i guess i've overcome this problem by requiring bcryptjs, instead of bcrypt. Here's the page for it

https://www.npmjs.com/package/bcryptjs.

I remember Chalkers advised it, in one of the NPM Package videos

bcrypt only works with stable/released versions of node. make sure you have the right version https://www.npmjs.com/package/bcrypt