JavaScript User Authentication With Express and Mongo User Registration Setting Up Mongoose and a Mongo Database

Julianna Kahn
Julianna Kahn
20,700 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' ] }

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.