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 trialeeeee eeee
16,283 PointsError: Cannot find module 'express'
$ nodemon src/app.js
2 Oct 07:17:19 - [nodemon] 1.7.1
2 Oct 07:17:19 - [nodemon] to restart at any time, enter rs
2 Oct 07:17:19 - [nodemon] watching: .
2 Oct 07:17:19 - [nodemon] starting node src/app.js
module.js:338
throw err;
^
Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (C:\Users\Erik\Desktop\Projects\Treehouse\Express\express-basics-4\src\app.js:3:15) at Module._compile (module.js:434:26) at Object.Module._extensions..js (module.js:452:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:475:10) 2 Oct 07:17:19 - [nodemon] app crashed - waiting for file changes before starting...
How can I fix it?
1 Answer
Pedro Sousa
Python Development Techdegree Student 18,546 PointsHello Erik,
Have you referenced express on your package.json file?
After that, you will need to run the command:
npm install;
eeeee eeee
16,283 Pointsnpm install seemed to work :P oh silly me. Thank you Pedro and Aleem!
Saad Aleem
6,089 PointsSaad Aleem
6,089 PointsCan you post the code where you require the file? And have you installed express using npm?