firebase-functions: Can't install firebase-functions due to dependency problem
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 firebase-functions@0.5.9 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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (7 by maintainers)
We’re seeing the same issue. We managed to get
to work though.
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?
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 firebase-admin@5.1.0 --save --save-exact
, this will put"firebase-admin": "5.1.0"
in your package.json.Can you try running this in your functions folder:
npm install firebase-functions@latest --save npm install firebase-admin@5.0.1 --save
If you still get errors, can you copy and paste here?
Fixed by https://github.com/firebase/firebase-functions/pull/66
This is not fixed. I get it with
firebase-functions@0.6.1
, which saysUNMET PEER DEPENDENCY firebase-admin@~5.1.0
.Then:
npm i --save firebase-admin
installs some 4.2.1, which is wrong.npm i --save firebase-admin@5.1.0
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?