How to set up Vue 3 Firebase project on MacOS - firebase

I am attempting to set up a VueJS Authentication app using Vue 3 and Firebase on my Mac Mini and Macbook. I have gone through the steps to add Firebase to my VueCLI project, by inputting npm install firebase in the terminal after cd-ing to the project. after running npm install firebase, Firebase appears as a dependency in package.json. However, after importing firebase and adding the firebaseConfig (from my firebase dashboard) to main.js, as well as importing firebase into App.vue, I get an error in the terminal saying:
This dependency was not found:
* firebase in ./src/main.js
To install it, you can run: npm install --save firebase
This appears to happen only when attempting to run a Vue/Firebase project on MacOS. What is the proper way to install Firebase on a VueCLI project when running that project on MacOS? Thanks.

Related

Firebase Next.js Hosting: Unable to find 'esbuild'

I'm trying to use Firebase's new Next.js support for Hosting (see https://firebase.google.com/docs/hosting/nextjs) but I'm getting a weird error when I try to deploy. (Everything runs correctly in the local emulator suite, btw)
Screenshot of Console output with error
When I try to run firebase deploy --only hosting,functions -m "testing out next.js support" I'm getting the error Unable to find 'esbuild'. Install it into your local dev dependencies with 'npm i --save-dev esbuild''. I've already added esbuild to my dev dependencies, and it seems to be installed correctly. My project uses yarn, not npm, but for the sake of testing I tried install it with npm like the error suggested, but that didn't work either.
Has anyone used Firebase Next.js hosting or figured it out since they've released it? The documentation on that page I linked above is... not great.
Make sure that you are using the latest Firebase Tools as per the documentation: "Firebase CLI version 11.14.2 or later".
Run npm install -g firebase-tools to update your version.

Firebase modular (v9) incompatible with Expo

I'm using Expo v42.0.1 and trying to install Firebase v9.0.2 and am unable to do so.
Issue
From running expo install firebase, firebase version 8.2.3 is installed. When changing the package.json to use firebase version 9.0.2, I get an error when running the app:
"firebase" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.
What I've tried
Running yarn / npm install
Running expo install firebase#9.0.2 (which ends up just downloading 8.2.3)
Has anyone seen this before or know why it is happening? I believe it is because Expo v42 is not yet compatible with the modular version of firebase (v9).
You are correct.
Has anyone seen this before or know why it is happening? I believe it is because Expo v42 is not yet compatible with the modular version of firebase (v9).
But you can make it work with using it like this in you package.json:
"#firebase": "^9.0.2",
Discussion about this: "firebase" is added as a dependency in your project's package.json but it doesn't seem to be installed
I have used this solution in 2 projects. 1 works perfectly but in another I faced issued where version firebase#9.0.0-beta.7 works perfectly but in version firebase#9.0.2 everything but Firestore works
More about it here: Expo + firebase#9.0.1/9.0.0: #firebase/firestore:, Firestore (9.0.0): Could not reach Cloud Firestore backend

Deploy a SSR Nuxt 2 application on firebase

I have some troubles deploying a Nuxt 2.4 application on Firebase.
I tried these 2 tutorials but they seem outdated:
https://www.youtube.com/watch?v=ZYUWsjUxxUQ
https://github.com/davidroyer/nuxt2-ssr-firebase
With the first tutorial, I could make my app working on local (after few hours and with a lot of modifications for babel integration) but I never could serve or deploy it. I thought the tutorial was old and manipulations can't be exactly done like the guy did.
With the second tutorial, I cloned the repository to try to deploy the example. I had to change 2 things : install Node 8 instead of Node 10 and upgrading firebase-admin to the last version in prod/server dir. Here is what I got:
npm run setup is ok
npm run dev is ok and the project works fine
npm run build is ok
npm run serve fails.
First I got this error :
The Cloud Functions emulator requires the module "firebase-admin" to be version >7.0.0 so your version is too old. You can probably fix this by running "npm install firebase-admin#latest" in your functions directory.
Indeed, the version configured in package.json is the 5.13. I did the update from the prod/server dir, and I get the 8.0.0.
And then I got a different error about gRPC :
Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v57-darwin-x64-unknown
Found: [node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
I tried npm rebuild as mentionned, without success.
npm run deploy fails.
I get this trace:
i deploying functions, hosting
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing prod/server directory for uploading...
Error: Error parsing triggers: Cannot find module 'acorn'
Try running "npm install" in your functions directory before deploying.
Of course, I tried the npm install from prod/server dir, but nothing changed.
Is there somewhere i can find a tutorial that can help me deploy my SSR app to firebase ? Thanks in avdance !
EDIT 1 :
After a few modifications on my package.json
upgrading firebase-functions and express to the latest versions
downgrading firebase-admin to the 7.0.0 version
adding acorn
I can serve and deploy but I get a "504 gateway time-out" webpage when I call the URL....
Have you tried to run npm install grpc inside functions folder?

React Native Firebase only works on iOS

I'm fairly new to React Native so I've been following the "The Complete React Native and Redux Course" by Stephen Grider. On section 9, lecture 59 he installs Firebase using npm with "npm install --save firebase", and so did I, however this only works for iOS for me. Whenever I run the app on an Android simulator I get this error saying Objects are not valid as a React child.
Screenshot
Edit: I'll try to explain this problem better as per advice from akraf. The only thing I need to do to recreate this Error is create a React Native project. Then install Firebase through npm to the project directory. Once I add the line "import firebase from 'firebase';" to the App.js file, the error occurs. Nothing else, just the import causes the error.
Try to install the version 5.0.2. Use this command as administrator:
npm install --save firebase#5.0.2
As far as i see, the current version (5.0.4) is buggy!

Meteor can't run gcloud on server side

I'm building a small application that allows you to upload files, store them in the cloud and analyze them with Google Cloud Vision API.
I got the uploading and storing working now, I use firebase for that, but when I try to run gcloud I run into some issues.
In the main.js file in server folder I run:
import gcloud from 'gcloud';
console.log('gcloud', gcloud);
But that causes an error in the terminal:
=> Started proxy.
=> Started MongoDB.
Unable to resolve some modules:
"memcpy" in /C/Users/Zino/Documents/Meteor Projects/find-it/node_modules/bytebuffer/dist/ByteBufferNB.js
(os.windows.x86_32)
If you notice problems related to these missing modules, consider running:
meteor npm install --save memcpy
My site does not load so I run:
meteor npm install --save memcpy
But then I get an error I'n can't find anything about in the internet:
node error log
I've been been trying to solve this issue for 2 days now, without luck. Any suggestions?
In my case, this was fixed by installing + importing specific sub-packages of google-cloud, rather than the google-cloud metapackage, which includes everything.
e.g.
$ npm install --save #google-cloud/datastore
$ npm install --save #google-cloud/storage
var config = {
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
};
var datastore = require('#google-cloud/datastore')(config);
var storage = require('#google-cloud/storage')(config);
To expand on Windows being the culprit: The build fails at 'node-gyp configure build', which has a build dependency on Visual C++ Build Tools / Visual Studio 2015 and Python 2.7 on Windows. It can build on Windows, but is not as straightforward as building on a Unix-y system due to lack of a standard C++ toolchain. The Microsoft Node.js Guidelines for Windows, which make special mention of 'running into dreaded node-gyp issues', should have all the steps needed to get the build to work.

Resources