Can't find module 'express'

javascript

#1

I’ve just gotten this error

    module.js:550

    throw err;

    ^


Error: Cannot find module 'express'

    at Function.Module._resolveFilename (module.js:548:15)

    at Function.Module._load (module.js:475:25)

    at Module.require (module.js:597:17)

    at require (internal/module.js:11:18)

at Object.<anonymous> (/app/server.js:2:17)

    at Module._compile (module.js:653:30)

    at Object.Module._extensions..js (module.js:664:10)

    at Module.load (module.js:566:32)

    at tryModuleLoad (module.js:506:12)

    at Function.Module._load (module.js:498:3)

I haven’t done anything I atleast think so. Could someone help me with how to fix this?


#2

Hey @SWP360 this often points to an error during module installation - that is to say that the problem’s not really with Express, per se, but instead Express is the first thing that Glitch couldn’t find.

This can often be fixed by running enable-pnpm in your project’s console to trigger a new install. If it doesn’t fix the problem then it might reveal installation errors in the Logs pane instead.


#3

Alright gonna try that


#4

I’ve gotten this error: https://paste.ee/r/aas2L

What should I do?


#5

Can you provide your project name? That’s a bit of an odd error that I’d like to investigate more closely.


#6

My project name is valiant-flax


#7

Some of the issues are sorted, but your project is stuck using npm instead of pnpm (which causes your node modules to take up space in your project’s space, instead of using shared space). I’m troubleshooting that in a remix so I don’t keep messing with your running project.

The install also seems to be failing when trying to build the canvas module (I think this is related to the above problem) but I’m not sure what’s going on there yet. My expectation is that anything in your project that uses canvas is probably not working - can you verify that?


#8

Cannot find module ‘canvas’


#9

I won’t need canvas for now also sorry for the late response had to do something


#10

No worries - I actually think I can resolve this a little more cleanly, but it will take your project down for a few minutes. Let me know if you’d like me to proceed.


#11

I’d like to proceed.


#12

Ok you should be all set (including canvas, I think)! Let us know if you run into further problems!


#13

Alright! Thanks a lot :slight_smile: :heart: