Cannot find module 'firebase'


#1

Hi guys,

I recently checked on my app here, dawger.glitch.me

In the log its throwing this error ‘Cannot find module firebase’.

I checked it out locally and it seems to be running fine for me, but as soon as I upload to glitch.me it fails to load the firebase dependency on line 1 of my server.js file.

Is there something I’m doing wrong or is there a bug in the loader perhaps?
Please see console error below.

I see in another ticket, someone had a similar problem:

The loader used to do an npm install I think, maybe the folder was removed and it fails to do them after a while, I’m not sure.

In any case to fix, I ran in the console: npm install
And now it generated node_modules folder, and website loads correctly then.

Thanks,

Console error:

internal/modules/cjs/loader.js:583

throw err;

^
**Error: Cannot find module 'firebase'**
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/server.js:1:78)

MOD EDIT: error formatting


#2

Hi @Kungfoowiz, instead of running npm install can you try running enable-pnpm in your console and let us know what happens then?

Occasionally we’ve seen a package get stuck during the automatic install process. Your project seems to be using npm, which is fine but causes your packages to take up space in your project’s available disk space. enable-pnpm will set it back to using pnpm, which will use the shared package store and not take up space in your project. That command will also trigger a forced install, which might clean up and lingering install problems.