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 Asynchronous Code in Express Asynchronous Code in Express Using Callbacks

couldnt get server to start

couldnt get the server to start for this application using the video files. i ran npm install to get the dependencies then when i tried npm start:

c:\Users\lyles\Development\Javascript-live\node.js\npm\AsyncExpressApp>npm start
npm ERR! path c:\Users\lyles\Development\Javascript-live\node.js\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'c:\Users\lyles\Development\Javascript-live\node.js\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\lyles\AppData\Roaming\npm-cache\_logs\2019-05-10T19_35_27_487Z-debug.log

when i try with nodemon and the main in my package.json is app.js:

c:\Users\lyles\Development\Javascript-live\node.js\npm\AsyncExpressApp>nodemon
  Usage: nodemon [nodemon options] [script.js] [args]

  See "nodemon --help" for more.

4 Answers

Jordan Russell
Jordan Russell
8,099 Points

I had issues with this as well. I was able to fix it by re-installing express, pug, and nodemon by typing "npm install express" and so on in the terminal. By doing this, the version of these dependencies will be updated to the latest version in the package.json file and the program should then work.

Typing 'npm install express' worked for me. I was stuck for a while. Thanks!

Yeah, Seth's answer was closest. You're in the wrong directory. The solution is to click on the "V2_starter_files_callbacks" and then "Open in Integrated Terminal" followed by npm install and then npm start in the terminal. Refresh in the browser and Bob's Your Uncle.

Seth Kroger
Seth Kroger
56,413 Points

I'd double-check which directory you're in when you run npm/nodemon. The download package has subdirectories for each video, "V2...", "V3...", etc. Make sure the directory you run from has an app.js and a package.json file.

Nicholas Lansing
Nicholas Lansing
8,901 Points

if you run npm install in the terminal it will install all needed dependencies from the package.json file included in the project files, that will let you run express, render pug, and use nodemon.