Update: Seems to have been fixed somewhere between firebase-tools 3.0.6 and 3.2.0
Recently firebase deploy has stopped working because it thinks that Bolt is not installed. It is installed both locally and globally. I've tried updating, uninstalling, manually deleting, reinstalling, and updating again in both location and it always gives the same error:
>firebase deploy
Error: There was an error loading firebase.json:
Bolt not installed, run npm install -g firebase-bolt
According to npm, firebase 3.2.1, firebase-tools 3.0.6 and firebase-bolt 0.8.1 are installed globally.
Contents of firebase.json:
{
"public": "web",
"rules": "rules.bolt",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
This is a known issue. Have a look here:
firebase-bolt not found on Windows #205
and test the package mentioned:
npm install -g oscar-b/firebase-tools
Related
I have Cloud functions project and i moved the project from my old laptop to my new laptop.
I have installed everything that necessary. My problem is when i try firebase deploy it gives me that error:
! functions: package.json indicates an outdated version of firebase-functions.
Please upgrade using npm install --save firebase-functions#latest in your functions directory.
I did that i have been told, but still it gives me the same error.
What should i do? And how i direct the npm install to my functions directory?
You need to run sudo npm install --save firebase-functions#latest in your functions directory. Cannot be in any other directory.
In Flutter this will be in
/path_to_your_flutter_project/functions
Hope this helped someone
I had the same problem.
You just need to run npm install -g firebase-tools
npm install -g firebase-tools
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
+ firebase-tools#7.0.0
That fixed my problem.
Update firebase-admin and make sure your root package.json file points to your functions folder
I am trying to understand how to get the version of firebase-admin that is required. My scenario is this:
MYPATH\functions>npm list firebase-admin
functions# MYPATH\functions
`-- UNMET PEER DEPENDENCY firebase-admin#6.5.1
npm ERR! peer dep missing: firebase-admin#^7.0.0, required by firebase-functions#2.3.1
Running npm update firebase-admin does not change anything.
package.json contains this line:
"dependencies": {
...
"firebase-admin": "^6.5.1",
What am I supposed to do?
UPDATE:
When doing firebase serve I get this error:
! Your requested "node" version "6" doesn't match your global version "10"
....
+ hosting: Local server: http://localhost:5000
! 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 functions: Your functions could not be parsed due to an issue with your node_modules (see above)
'npm update' is working, however the '^' carat against "firebase-admin" in your package.json will limit the updates to the 6.x releases - so it's not getting anything newer then the 6.5.1 release.
You can manually change the version of "firebase-admin" in your package.json to "^7.0.0" and then run 'npm install'. This will grab the latest release in the 7.x.x range.
After upgrading firebase-tools from 6.8.0 to 6.9.0 my local function stopped working. I get below error message when calling it from my application:
λ firebase.cmd serve --only functions:upload
+ functions: Using node#12 from host.
+ functions: Emulator running at http://localhost:5001
i functions: Beginning execution of "upload"
! Error: Cannot find module 'package.json'
Require stack:
- C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at verifyDeveloperNodeModules (C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:125:32)
at C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:457:26
at Generator.next (<anonymous>)
at C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:3:12)
! Your function was killed because it raised an unhandled error.
I have reinstalled node and npm entierly (including deleting %appdata% files), deleted all node_module files and reinstalled everything with npm ci but problem remains.
firebase.cmd is version 6.0.0
How do I continue? I could serve the very same function before upgrading, but now even if trying to downgrade using npm i firebase-tools#6.8.0 problem remains.
The function right now:
const functions = require('firebase-functions');
exports.upload = functions.https.onRequest((req, res) => {
console.log('Upload initiated')
return null;
});
I had the same problem after upgrading from firebase-tools 6.7.2 to 6.9.0
These steps worked for me to roll back to a previous version on Windows 10:
Uninstall the functions-emulator
Uninstall firebase-tools
Remove the functions-emulator config <== This is the step I didn't know about
Re-install a previous version of firebase-tools (6.7.2 or 6.8.0)
Detailed steps:
Switch nodejs version if you have multiple. I removed the functions-emulator and firebase-tools from all versions. Uninstalling needs to be done for each version separately.
nvm use 8.16.0
Uninstall the functions-emulator. More info: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki/Troubleshooting
npm uninstall -g #google-cloud/functions-emulator
Uninstall firebase-tools
npm uninstall -g firebase-tools
Delete the functions-emulator configuration folder found at 'C:\Users\yourusername\.config\configstore#google-cloud\functions-emulator'
Install a previous version of firebase-tools. Versions are listed at https://www.npmjs.com/package/firebase-tools
npm install -g firebase-tools#6.8.0
I believe you may only be able to use the functions-emulator with one nodejs version so if you install it with 8.16.0 then make sure you've switched to that version with '> nvm use 8.16.0' before you start testing cloud functions locally
Login to firebase
firebase login
In your project directory update the functions and admin packages
npm install firebase-functions#latest firebase-admin#latest --save
Start testing locally
firebase functions:shell
Or use
firebase serve
Note: Calling the functions-emulator directly with 'firebase emulators:start' won't work.
Follow this issue on github for updates: https://github.com/firebase/firebase-tools/issues/1258
functions: Cannot start emulator. Error: Cannot find module '#google-cloud/functions-emulator/src/config'
This is the error message I get when I try to run functions locally on Mac. My Firebase version is 3.16.0. I tried doing sudo npm install -g #google-cloud/functions-emulator as well. But still no use. Please help.
Solution is:
yarn global add firebase-tools
yarn global add #google-cloud/functions-emulator --ignore-engines
Working Solution!(OSX) None of the above worked for me. After a long struggle, I found the following solution.
cd my_project/functions
npm install #google-cloud/functions-emulator
Copy #google-cloud/functions-emulator folder generated inside node_modules.
cd /usr/local/lib/node_modules/#google-cloud && open .
Paste the functions-emulator folder here.
In your project's root directory, copy package.json inside functions/node_modules/#google-cloud/functions-emulator
cd /usr/local/lib && open .
Paste the package.json here.
npm install
Hurray! You are good to go. Now go back to your project's root directory and run.
sudo firebase serve --only hosting,functions
And the emulator should start normally.
Note: Do not run sudo npm install -g #google-cloud/functions-emulator since the files will be removed and reinstalled. This is where the installation fails and emulator fails to run.
Hope this helps!
The following worked for me.
npm uninstall -g firebase-tools && npm i -g firebase-tools
npm i --save #google-cloud/firestore
npm i --save #google-cloud/common-grpc
npm i -g #google-cloud/functions-emulator
npm i --save firebase-functions
current package.json snippet
"dependencies": {
"#google-cloud/common-grpc": "^0.5.3",
"#google-cloud/firestore": "^0.11.1",
"firebase-functions": "^0.8.1",
"firebase-admin": "5.8.1"
}
My system: Ubuntu 16.04.3
I had the same problem and the reason is that "#google-cloud/functions-emulator" is not installed in the 'npm global packages folder'.
In my case it happened because I installed firebase-tools globally using yarn, and I used it because when installing firebase-tools globally using npm I was getting an folder access error, which did not happen with yarn.
What I did to solve the problem was to follow these simple instruction from npm website to use a different folder for npm global packages (https://docs.npmjs.com/getting-started/fixing-npm-permissions).
Then I installed again with 'npm install -g firebase-tools' (without sudo) and it worked perfectly.
I had the same problem, using Ubuntu 17.10.
Note: You do not need to, and should not, use sudo for the installation.
I resolved this by performing the following:
Uninstall any previously attempted installed of the functions emulator.
npm uninstall -g #google-cloud/functions-emulator
and to make sure:
yarn global remove #google-cloud/functions-emulator
Delete all files in ~/.config/configstore/#google-cloud/functions-emulator. Note that there are some hidden files in this directory.
rm -rf ~/.config/configstore/#google-cloud/functions-emulator
Install nvm (node version manager) by following the instructions here:
https://github.com/creationix/nvm#install-script
Use nvm to install a specific version of node - at the time of writing, the Google Cloud Function Emulator (version 1.0.0-alpha.29) specifically requires 6.11.5.
nvm install 6.11.5
Install the Google Cloud Platform SDK:
https://cloud.google.com/sdk/
Reinstall the functions emulator:
npm install -g #google-cloud/functions-emulator
Start the emulator to verify installation has succeeded:
functions start
IMPORTANT: Subsequently, when attempting to create a function that can be tested locally or deployed to Google Cloud, you should use the firebase init functions command within your project, and allow this to install dependencies via npm. A walkthrough of creating a test function with Firebase can be found here:
https://firebase.google.com/docs/functions/get-started
i am windows user and trying to update firebase version using
npm install -g firebase-tools but when i run firebase --version
it shows the same version.
I also run npm uninstall firebase --save and check firebase --version it shows same.
what should i do to update my firebase version?
npm update -g firebase-tools
or
npm install -g firebase-tools#3.12.0 to install a specific version
And make sure to restart your terminal/IDE otherwise, it won't take effect.
Have you tried npm update -g firebase-tools? This worked for me.
These days if you're on an older version, and you check the version of firebase-tools, by running:
firebase -V
along with the version of firebase-tools that you're on, it also gives you a messages, something like this:
So you can basically run npm i -g firebase-tools to update the version of your firebase-tools installation to the latest version.
Hope this helps :)
For other like me stumbling in with a weird version mismatch:
When I did firebase -V in my terminal I would get a different version (5.1.1) than when I ran firebase through a npm run script (3.19.3)
The problem was that I had previously installed firebase locally into that project. In other words, I was getting the global version in the terminal, but npm was using the node_modules version
To confirm this, I added a simple test called test-foo to my package.json (firebase -V && which firebase) and ran it:
kuzyn(λ)matebox‡ npm run test-foo
kuzyn-project#1.1.0 test-foo /home/kuzyn/code/kuzyn-project/firebase
firebase -V && which firebase
3.19.3
/home/kuzyn/code/kuzyn-project/firebase/node_modules/.bin/firebase
Then I removed the (uneeded in my case) local firebase package from the package.json and from node_modules
Try the 2 steps bellow
1. yarn/npm cache clean
2. npm install -g firebase firebase-tools or yarn add -g firebase firebase-tools
in a new terminal, firebse --version
works for me
it works to me...
standalone binary: Download the new version, then replace it on your system
if you are using the standalone.Download the new version
In my case I was using an old node version (v10) and had to switch to a newer one (v12). After that I ran npm install -g firebase-tools again and it was updated to the latest version.
You can check the current node version by running node -v. And I use nvm to switch to a different node version.
That might happen in case you've installed the firebase-cli using a so called automatic install script.
Try to call curl -sL https://firebase.tools | upgrade=true bash as described in the official documentation