0
votes

Currently I am trying to run a very basic to do list using node. After setting up package.json and server.js, I ran npm start run, but I am getting a weird error.

UPDATE: Here is the basic code and .json file: enter image description here

var express = require('express'),
app = express(),
port =process.env.PORT ||3000;

app.listen(port);

console.log('todo list RESTful API server started on: ' + port);

This is the error: enter image description here

This is the complete log page: enter image description here

1
It's very hard to figure out what the problem is with your code if you don't post the code. - CertainPerformance
updated the post and included a picture - Ejmin Mehranian
@EjminMehranian An image of the code is not search friendly, aside from other problems. Post the code. Not an image of it. - Daedalus
No, don't post pictures of code, post the actual code - CertainPerformance
I mean its 4 lines of code lol.Anyways I included the code as well. - Ejmin Mehranian

1 Answers

1
votes

I ran into the same problem with nodemon when running my test scripts in a node.js api.

It seems the error is related to this issue with nanomatch, a package nodemon uses, a link to the issue: https://github.com/micromatch/nanomatch/issues/15.

I solved it with the following steps:

  1. Verify the version of nanomatch in node_modules/nanomatch/package.json if the version is 1.2.11 (I also had a similar issue with 1.2.9) you need to change its version.
  2. Run npm i [email protected] (--save or --save-dev according to your situation)

After these steps nodemon worked for me. Hope that helps.