TypeError: firebase.storage is not a function
DEPRECATED, see below:
According to this answer, instead of firebase storage, in Node.js, google-cloud
package storage should be used, and it seems that this answer should confirm it. Code example:
npm i --save google-cloud
Then:
const gcloud = require('google-cloud')
const storage = gcloud.storage({
projectId: '<projectID>',
keyFilename: 'service-account-credentials.json',
});
const bucket = storage.bucket('<projectID>.appspot.com')
As of 2018, this is the correct answer:
Or using only the storage part of the package:
npm install --save @google-cloud/storage
And then:
var storage = require('@google-cloud/storage')
Also check the docs for more.
I faced the same problem. In my case, I needed to include storage module besides Firebase core.
import firebase from 'firebase/app';
import 'firebase/storage'; // <----
firebase.initializeApp({
...
});
const storageRef = firebase.storage().ref();
(npm firebase v5.0.4)