Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
Last active January 7, 2017 13:44
Show Gist options
  • Save simenbrekken/5166425 to your computer and use it in GitHub Desktop.
Save simenbrekken/5166425 to your computer and use it in GitHub Desktop.
Firebase NPM doesn't expose the token generator dependency

There are some ways to fix this:

  1. Remove dependency and let users install it manually as needed, the token generator isn't really a hard dependency of Firebase anyway
  2. Expose the dependency from the firebase module:
    var Firebase = require('firebase')
        FirebaseTokenGenerator = Firebase.TokenGenerator
$ mkdir firebase-npm-test
$ cd firebase-npm-test
$ npm install firebase
npm http GET https://registry.npmjs.org/firebase
npm http 304 https://registry.npmjs.org/firebase
npm http GET https://registry.npmjs.org/firebase-token-generator
npm http GET https://registry.npmjs.org/faye-websocket
npm http 304 https://registry.npmjs.org/faye-websocket
npm http 304 https://registry.npmjs.org/firebase-token-generator
firebase@0.5.0 node_modules/firebase
├── firebase-token-generator@0.1.2
└── faye-websocket@0.4.4
$ node
> require('firebase-token-generator')
Error: Cannot find module 'firebase-token-generator'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at repl:1:2
at REPLServer.self.eval (repl.js:109:21)
at Interface.<anonymous> (repl.js:248:12)
at Interface.EventEmitter.emit (events.js:96:17)
at Interface._onLine (readline.js:200:10)
at Interface._line (readline.js:518:8)
>
@eryno
Copy link

eryno commented Jan 24, 2016

Thank you for posting this! Saved me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment