I tried running firebase serve on my local machine and gets below warning
The Cloud Functions emulator requires the module "firebase-admin" to
be installed. This package is in your package.json, but it's not
available. You probably need to run "npm install" in your functions
directory.
What I've tried from previous SO and github
npm install from folder functions
delete node_modules and re-run npm install
run npm install --save firebase-admin
SO and github references but non solved my problem
The Cloud Functions emulator requires the module "firebase-admin" to be installed
Im having trouble while serving or deploying Firebase Hosting Functions
https://github.com/firebase/firebase-tools/issues/1452
PS:
Downgrade to version 6 is not an option.
I'm running node 8 and "firebase-admin": "^8.6.0" as shown from package.json
With the help of Hiranya Jayathilaka comment above I was able to fix this. I upgraded my node from 8.5.x to 8.16.2 and run npm install firebase-tools and everything works fine.
Related
I'm using my work computer while developing a sort of side project. Nothing crazy just learning some new firebase stuff. Anyways, because it is a work computer I can't install modules globally. So when it came to installing firebase-cli I tried using the recommended global command:
npm install -g firebase-tools
That didn't work because I don't have permission due to this being a work computer. So I created a firebase folder just for this project and ran
npm install firebase-tools
In the new folder. Once finished I tried running
firebase -version
But this resulted in
firebase: command not found
I thought this would work since I'm in the directory I created and installed firebase in but it doesn't work. Any help please!
If you want to run any command from a package that was installed in a project, use npm exec from the project folder.
npm exec -- firebase [CLI args]
The version command you were trying to run would go like this (note it's two dashes for the flag)
npm exec -- firebase --version
By mistake I had installed the higher version of serverless on my pc. Now I want to degrade my serverless framework version from v2.41.2 to v2.35.0 due to some project requirements.
What I had tried to do:
I uninstalled the current serverless framework with npm uninstall -g serverless.
Then ran this command npm install -g serverless#2.35.0
But when I ran this command serverless --version it is still showing the version 2.41.2 on my pc.
In addition to being installed globally via NPM, serverless can also be a project dependency. If you're working in a node project, ensure that serverless isn't listed in the package.json file or in the package-lock.json file.
If so, run npm uninstall serverless and then npm install -d serverless#2.35.0, to install the framework in the project at the correct version.
The Cloud Functions emulator requires the module "firebase-admin" to
be installed. This package is in your package.json, but it's not
available. You probably need to run "npm install" in your functions
directory.
I was running well my project till i was hit with that issue. Any help, please do tell. Thanks. {Below is the image of what i am getting}
This is a bug in firebase-tools versions 6.9.0 and 6.9.1. The solution is to downgrade to 6.8.0 for now:
npm install -g firebase-tools#6.8.0
You can follow along with the issue here:
https://github.com/firebase/firebase-tools/issues/1262
When I try to deploy functions with the firebase-tools cli I always receive a Deployment error for every function. The output looks like this:
! functions[import]: Deployment error.
Error in the build environment
I have tried to deploy in different ways:
firebase deploy --only functions
and
firebase deploy --only functions:[function-name]
Both result in a Deployment error. The packaged functions folder gets upload successfully.
Is there any way to update my current functions?
I did as #Jirawatee has suggested but was then having some issues with my node version.
So I changed my version of node to V8 and added the engine key my package.json. then removed my node modules, reinstalled them and tried the deploy again
so:
1.) install updates
npm install firebase-functions#latest firebase-admin#latest --save
npm install -g firebase-tools
2.) change your global node version to 8 I personally use Nodist for Windows to manage my node version
3.) add engine to package.json
"engines": {
"node": "8"
},
4.) remove and reinstall node modules
rm -rf node_modules && npm install
5.) finally, run your firebase build / deploy script
I meet this problem too and I fix it by command lines below.
npm install firebase-functions#latest firebase-admin#latest --save
npm install -g firebase-tools
Hope it will help :)
I'm trying to push to cloud functions for my iOS app. I followed the Firebase does and installed node in my folder but now I'm getting this error trying to push it up
Error: Error parsing triggers: Cannot find module 'firebase-admin'
UPDATES
Trying to get latest firebase-admin returns invalid
Running npm uninstall firebase-admin
and then running npm install firebase-admin puts out these errors...
I got a similar issue in my project. I solved it by removing the node_modules folder with rm -rf node_modules, then in package.json changing manually the versions for both firebase-functions to 0.7.3 and fire-amin to 5.5.0. After that just run npm install again.