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 Adding Data to the Database

npm ERR! treehouse-express-auth@1.0.0 start: `node ./app`

Not sure what I'm doing wrong:

  • I have Mongo setup on my computer
  • I did all the necessary npm installs

npm start doesn't work - npm ERR! treehouse-express-auth@1.0.0 start: node ./app nodemon doesn't work

I'm in the right directory but clearing I'm missing something.

Appreciate your help, best vote gets points =)

Cheers!

{
  "name": "treehouse-express-auth",
  "version": "1.0.0",
  "description": "A project for learning how to add authentication to a web application.",
  "author": "Treehouse Island, Inc.",
  "private": true,
  "scripts": {
    "start": "node ./app"
  },
  "dependencies": {
    "body-parser": "^1.13.3",
    "express": "^4.13.4",
    "mongoose": "^4.5.0",
    "pug": "^2.0.0-beta2"
  },
  "license": "MIT"
}

Nodemon Error:

[nodemon] 1.14.8
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./app`
module.js:557
    throw err;
    ^

Error: Cannot find module 'mongoose'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/zfreitag34/Desktop/Treehouse/Express-File/user-auth-express/S2V8/app.js:3:16)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
[nodemon] app crashed - waiting for file changes before starting...

Do you see mongoose in your node_modules folder? Did you run npm install before running npm start? The error seems to result from 'require' not being able to resolve the package 'mongoose'

1 Answer

@Alexander La Bianca mongoose is in my node_modules folder and for some reason it is working today. I'm sure I was a little too tired to think straight last night.