Error with Express


#1

So I was working on a project yesterday. No today I come back and one of my projects won;t load Express and erroring out. How do I fix this?

internal/modules/cjs/loader.js:550

throw err;

^

Error: Cannot find module ‘express’

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)

its in this project

I haven’t changed anything that would affect this - package.json

},
“dependencies”: {
“express”: “^4.16.3”,
“currency-formatter”: “^1.4.2”,
“node-zillow”: “^1.0.1”,
@google/maps”: “^0.4.6”,

Help!


#2

Hi @Jeff,

what is the name of the project?


#3

https://purple-diploma

I found a previous post that you answered to run this in the console - enable-npm and it seems to have fixed it

So is that the best thing to do is just run that command? Because I hadnt added any packages or anything. I did leave this up plus the console and let my PC go to sleep mode over night - I didn’t shut down my project or console - could that do it?


#4

Glad you figured out a way to fix it. I looked at your code, it appears that there was some kind of invalid character in your package.json that prevented pnpm (our default package manager) from working correctly.

It should be a transient error though, you shouldn’t get it anymore. If it happens again, let us know :slight_smile:


#5

Thank you so much!! Appreciate the great support here as I am a beginner wit Node - 20+ years in IT but not JS. So thanks again!