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 User Registration Setting Up Mongoose and a Mongo Database

Julianna Kahn
Julianna Kahn
20,702 Points

Opened a new file and project won't connect to loalhost3000

I reinstalled node, mongo and mongoose. I get the following error:

Julianna-Computer-2:~/Desktop/JavaScript-user-auth-express/S3V6] julianna% node app.js internal/modules/cjs/loader.js:626 throw err; ^

Error: Cannot find module 'bcrypt' Require stack:

  • /Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/models/user.js
  • /Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/routes/index.js
  • /Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/app.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15) at Function.Module._load (internal/modules/cjs/loader.js:527:27) at Module.require (internal/modules/cjs/loader.js:681:19) at require (internal/modules/cjs/helpers.js:16:16) at Object.<anonymous> (/Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/models/user.js:2:14) at Module._compile (internal/modules/cjs/loader.js:774:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) at Module.load (internal/modules/cjs/loader.js:641:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Module.require (internal/modules/cjs/loader.js:681:19) at require (internal/modules/cjs/helpers.js:16:16) at Object.<anonymous> (/Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/routes/index.js:3:12) at Module._compile (internal/modules/cjs/loader.js:774:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) at Module.load (internal/modules/cjs/loader.js:641:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/models/user.js', '/Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/routes/index.js', '/Users/julianna/Desktop/JavaScript-user-auth-express/S3V6/app.js' ] }

1 Answer

Most likely you need to rerun npm install in your project directory for npm to install all the necessary modules. This is an easy mistake to make if you change folders to catch up to the current video.