Skip to content
← Back to Community
Problems with Repl.it not able to find module 'express'
Profile icon
LukeZeller

Hello!
I've been having a problem where whenever my repl wakes up, it throws this error:

internal/modules/cjs/loader.js:550 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object.<anonymous> (/home/runner/index.js:1:77) at Module._compile (internal/modules/cjs/loader.js:654:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) exit status 1

The way I've found to fix it is to rename package.json to something else, start the repl, fix the name of package.json, and restart the repl.
Is there a fix on the way? Or a better way to do this?

Voters
Profile icon
SefRel
Profile icon
alanslurring
Profile icon
LukeNarke
Profile icon
ZhixianYe1
Profile icon
seyrharp
Profile icon
LukeZeller
Comments
hotnewtop
Profile icon
hyperupcall

hey!

page refreshes typically fix most common miscellaneous bugs. if that doesn't work, then navigating to the "my repls" screen, refreshing, then navigating back to your repl usually fixes some bugs. kind of strange because i've never come across an error like that.

hope i could help :)

Profile icon
turbio

It looks like your package has an invalid name according to npm's docs. We use npm under the hood to install packages so if npm rejects your package.json we won't be able to install anything.

Profile icon
LukeZeller

@turbio
the package in question was installed automatically, and when i rename the pacakge.json file, the package works fine.