Can't find module 'express'

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?

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.

Alright gonna try that

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

What should I do?

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

My project name is valiant-flax

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?

Cannot find module ‘canvas’

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

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.

I’d like to proceed.

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

Alright! Thanks a lot :slight_smile: :heart:

1 Like