captain_jon_sparrow captain_jon_sparrow - 2 years ago 101
Node.js Question

Node.js error: Cannot find module 'firebase/storage'

I've been using Firebase Cloud Storage for my app, and so I required 'firebase/storage' in my server.js file, as shown below. The code was working fine last night, but when I tried "node server.js" this morning, I keep getting the module error:

Error: Cannot find module 'firebase/storage'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ubuntu/workspace/app.js:10:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)


Here is a snippet of the server.js code:

var express = require('express');
var logger = require('morgan')
var bodyParser = require('body-parser')
var app = express();
var path = require('path');
var formidable = require('formidable');
var fs = require('fs');
var admin = require('firebase-admin')
var storage = require('firebase/storage')


I've initialized in the fireabase app and made correct references to the firebase storage in my html and js, or else my code would not have worked last night. Why am I getting this error now?

Answer Source

You should use this lib to use storage.

npm install firebase

https://firebase.google.com/docs/storage/web/start

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download