Skip to content
Problems with not able to find module 'express'
Profile icon

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?

You are viewing a single comment. View All
Profile icon

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

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