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 Introducing the Practice

mohamed adam
seal-mask
.a{fill-rule:evenodd;}techdegree
mohamed adam
Full Stack JavaScript Techdegree Student 11,884 Points

npm start doesnt work

i do not why this express workshop files dont work for me when i npm start. this is the error i get. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\64204\AppData\Roaming\npm-cache_logs\2020-08-04T06_57_01_033Z-debug.log

Simon Coates
Simon Coates
8,228 Points

I initially got an error, but it was because I was in the wrong directory to run the command. In the right directory, I was able to run npm install. But I got an error on npm start. I had to manually run 'npm install nodemon --save' and then things worked as expected. (In the event you resolved this weeks ago, I thought it might be applicable to other people who have errors)

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Mohamed.

You may need to check that npm is installed for your project either globally so you can use it for your project or that the projects JSON file is included for your project.

You can check npm is ready by typing npm -v in your terminal.

Also in the root of your project you can make sure the project dependencies are correctly installed using npm install.

Let us know if this helps! :-)

James Crosslin
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
James Crosslin
Full Stack JavaScript Techdegree Graduate 16,882 Points

I'm also getting an error when I attempt to run this project. I know why, however.

package.json for the project

{
  "name": "express-template",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "nodemon ./bin/www"
  },
  "dependencies": {
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "morgan": "~1.9.1",
    "pug": "^2.0.4"
  }
}

This start script requires nodemon but it is not listed in the dependencies. I purposely do not install dependencies like nodemon to my root, since this is a security risk. Adding nodemon to the dependencies would probably be a good idea.

For those facing the same issue, run npm install -D nodemon and you should be good to go.