Ejmin Mehranian
Ejmin Mehranian

Reputation: 37

npm start run error "var before = prev.prev || {}; TypeError: Cannot read property 'prev' of undefined"

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

Upvotes: 0

Views: 287

Answers (1)

Roodey
Roodey

Reputation: 55

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.

Upvotes: 1

Related Questions