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
Shawn Parrotte
6,689 PointsHow do I "require" bcrypt when I'm using a local install of node?
Basically, I'm trying to run my "app.js" from a folder on my desktop. And when I require bcrypt, it's looking for it - I presume - in the project folder. What path would I use (or how do I learn what path to use) so I can finish this part?
Thanks!
2 Answers
Paul Ogden
7,709 PointsIf you have added bcrypt as a dependency in your package.json file and then used npm install, your project should now have bcrypt included. From there it should be as simple as adding something like var bcrypt = require('bcrypt'); at the top of your app.js
Paul Ogden
7,709 PointsUnfortunately, I haven't done any of the node courses on treehouse yet, so I don't know if they go in to it or not. This is a pretty good explanation of it though:
http://www.sitepoint.com/beginners-guide-node-package-manager/
Shawn Parrotte
6,689 PointsYea, I'm doing the npm section at the moment and I'm making sure to do all the exercises locally instead of the workspaces. Andrew might get to it, but this is perfect for what I need to know right now. Thank you!
Shawn Parrotte
6,689 PointsShawn Parrotte
6,689 PointsThanks Paul. I wish I understood what the first sentence means or how to do it, I imagine it would do me better in the long run, but I ended up locating bcrypt in the default location (which took some digging) and pointed to that in my app.js file.
Where could I go to understand what you recommended?