Firebase-functions: Can't install firebase-functions due to dependency problem

Created on 14 Jul 2017  Â·  15Comments  Â·  Source: firebase/firebase-functions

Version info

firebase-functions: 0.5.9

firebase-tools:

firebase-admin: 5.0.1

Test case

My Firebase app is configured with functions, although I haven't used them yet.

Steps to reproduce

To use functions (I need them to read environment variables for my app configuration) I tried to npm i firebase-functions -S. This gave a warning:

npm WARN [email protected] requires a peer of firebase-admin@~4.2.1 but none was installed.

So I tried to npm i firebase-admin. But that still gives me the above warning. Seems to me, that firebase-functions only works with an older version of firebase-admin. So I tried to install the older version by npm i firebase-admin@~4.2.1 -S.

But that gives me the following error when trying to start my react application:

Module not found: Can't resolve 'dns' in '/Users/morgler/code/dreimannzelt/sonnendepot/pricing/node_modules/firebase-admin/node_modules/isemail/lib'

Were you able to successfully deploy your functions?


No

Expected behavior

I don't really need functions. I simply want to read ENV variables for configuring staging and production environments differently. npm i firebase-functions should simply work.

Actual behavior

I get dependency warnings. Even when trying to install the exact version of the dependency, I get errors.

Most helpful comment

We're seeing the same issue. We managed to get

"firebase-admin": "4.2.1",
"firebase-functions": "0.5.9",

to work though.

All 15 comments

We're seeing the same issue. We managed to get

"firebase-admin": "4.2.1",
"firebase-functions": "0.5.9",

to work though.

Thanks, I will try that combination of versions.

I did not get the 0.5.9 combination of @ahaverty to work – it shows the same error for me :(.

Also using the latest version today still gave me 0.6.0 and demanded firebase-admin 5.0.1.

Can you try running this in your functions folder:

npm install firebase-functions@latest --save
npm install [email protected] --save

If you still get errors, can you copy and paste here?

This is not fixed.
I get it with [email protected], which says UNMET PEER DEPENDENCY firebase-admin@~5.1.0.

Then:

npm i --save firebase-admin installs some 4.2.1, which is wrong.
npm i --save [email protected] installs 5.1.0, which is right but now obviously I have "firebase-admin": "^5.1.0" in my package.json :(

I don't know why npm i --save firebase-admin installs a 4.x though, since npm reports that the latest version is 5.2.1 :/

Can you please reopen?

This is not a bug, it's just quirks with how npm install works. Running npm i --save firebase-admin inside a directory that already has a package.json which has a firebase-admin field will install the version that is indicated in the package.json, not the latest version in npm.

Try running npm i --save [email protected] --save --save-exact, this will put "firebase-admin": "5.1.0" in your package.json.

https://github.com/firebase/firebase-tools/pull/434 will also update the default "firebase init" template, which will hopefully alleviate some of the npm pain.

isn't the point of using package managers and package manifests with exact versions to avoid manually wrangling with versions? Or is this not possible with npm packages? Note: I am completely new to npm/node

I'm seeing dependency issues as well.
firebase-admin: 5.2.1

➜  customer-manager (master) ✗ yarn add firebase-admin                                                    .../customer-manager
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
├─ @google-cloud/[email protected]
└─ [email protected]
Done in 4.74s.

➜  customer-manager (master) ✗ yarn start                                                                 .../customer-manager

yarn start v0.27.5
$ node build/dev-server.js
> Starting dev server...

 ERROR  Failed to compile with 22 errors                                                                            10:37:27 PM

These dependencies were not found:

* fs in ./~/firebase-admin/lib/auth/credential.js, ./~/@google-cloud/storage/src/bucket.js and 10 others
* net in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 3 others
* tls in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 1 other
* child_process in ./~/google-auth-library/lib/auth/googleauth.js
* dns in ./~/isemail/lib/isemail.js

@esparkman can you file this as an issue on https://github.com/firebase/firebase-admin-node?

@laurenzlong sure thing. Any additional information needed?

Can you try to repro this in a plain-old clean directory? (I'm pretty sure you'll be able to, since this seems to be a firebase-admin issue that's independent of Functions). Then make sure you follow the issues template for firebase-admin. Thanks!

Tried with admin: 4.2.1 and functions: 0.5.9 and got the same error.

./node_modules/firebase-admin/node_modules/isemail/lib/isemail.js
Module not found: Can't resolve 'dns' in '/Users/devmode/Documents/projects/google-crm/node_modules/firebase-admin/node_modules/isemail/lib'

Error fires when I require('firebase-admin')

Anyone figured anything out?

@KevinMind Please only indicate issues with the latest versions of each of the modules. Your versions are outdated. And as indicated above, if you still experience issues after using the latest versions, please file the issue on firebase-admin-node, not here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sokraflex picture sokraflex  Â·  3Comments

TomClarkson picture TomClarkson  Â·  5Comments

piuccio picture piuccio  Â·  4Comments

ahaverty picture ahaverty  Â·  6Comments

timdiacon picture timdiacon  Â·  5Comments