1

My server works well when I run node app.js. However, I am trying to use nodemon to run my server and it doesn't start.

npm start shows the following error:

npm ERR! code ELIFECYCLE
npm ERR! errno 9009
npm ERR! lab11@1.0.0 start: nodemon app.js
npm ERR! Exit status 9009
npm ERR!
npm ERR! Failed at the lab11@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

My package.json:

{
  "name": "lab11",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "nodemon": "^2.0.7"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

My app.js

const express = require('express');
const app = express();

app.use((request, response, next) => {
    console.log('Middleware!');
    next();
});

app.use((request, response, next) => {
    console.log('Otro middleware!');
    response.send('¡Hola mundo!');
});

app.listen(3000);

I already tried to:

  • Delete node_modules and run npm install
  • Delete package-lock.json, run npm cache clean --force and run npm install
  • Delete all files and repeat the installation process
  • Add npm to path
  • Other solutions to this question
  • 4
    Please edit your question to include the content of `app.js` - this error code will sometimes appear when your script has a syntax error. What happens when you simply try to run your script using `node app.js`? – esqew Mar 05 '21 at 15:42
  • @esqew thanks for the recommendation. I actualized my question. – Mariana Soto Mar 06 '21 at 00:20

1 Answers1

0

According to this answer there are still a few options that you might want to try:

DadiBit
  • 769
  • 10
  • 22