I'm using the react native firebase guide to install firebase in my react native app: https://rnfirebase.io/#2-android-setup
The installation has been successful and firebase is connected to my app.
However when I try to import from the SDK, I'm getting an error that it's not found:
import firebase from 'react-native-firebase'
The error reads:
Undefined Unable to resolve module 'react-native-firebase' from 'App.js'...
As the docs instruct I just used npm install like so:
npm install --save #react-native-firebase/app
And the package is indeed installed. So what could be the reason? Is it not an SDK anymore?
Step 1. Clear watchman watches: watchman watch-del-all
Step 2. Delete the node_modules folder: rm -rf node_modules && npm install
Step 3. Reset packager cache: npm start -- --reset-cache
Related
I am using react native and Expo. I am unable to build new app because after I use expo init appName it shows the following error.
Heres the full message:
📦 Using npm to install packages. You can pass --yarn to use Yarn instead.
√ Downloaded and extracted project files.
× Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app.
✅ Your project is ready!
To run your project, navigate to the directory and run one of the following npm commands.
- cd Scanner
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios # requires an iOS device or macOS for access to an iOS simulator
- npm run web
I tried multiple times to create a blank project, also tried npm install to install failed/not downloaded libraries and continue after failure but it showed another error:
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
also tried npm cache verify that showed cache is ok Content verified: 3562 (252580364 bytes).
So, How can I solve this issue?
Problems related to npm installation are very common If you do any mistake in early installation, but is avoided. Learn more about npm tree.
Steps worked for me are :
npm cache clean --force
npm cache verify
npm -g uninstall expo-cli --save
npm install expo-cli --global
expo init app-name
cd app-name
npm start
Always run as administrator if working on Windows and in root directory.
The solutions above didn't work for me but if you use 'npm install' in the directory of the app you get a clue that you shuold try 'npm install --force'
err message
You should have all these files folders and files at the start of the project otherwise not all the dependencies have been installed which is why we were getting the problem.folder structure
After you have added --force to npm install you have all the dependencies installed. Now you can run the app with npm start.
Unfortunately, all the solutions described above didn't work on my machine...
Here is my latest solution for this problem...
This worked 100% on my machine...
Use npm i -g expo-cli
This will automatically add the required packages and also remove the unnecessary ones.
Yes, surely, you don't need to uninstall and re-install it again.
Just follow my steps.
And, you can create your expo project using expo init.
I hope my solution will help you out from this annoying problem....
I just did npm install and it worked for me, but I had do that every time I create a new expo project.
I also encountered this problem, and finally found that it was the problem of react native cli,I installed the latest version of react native cli,Expo is back to normal
This Error is regarding to the git account. expos need a git account to setup react native project
If you are using windows you need to install git in your local PC
after that open your Terminal and type this command
git config --global user.name "your_username"
git config --global user.email "your_email_address#example.com"
after that clone any github project to your local computer. it will ask to login to Github
after all these steps try expo init <projectname>
The simple way to settle that error is by using "expo-cli init app-name" instead of "expo init app-name".
I tried and worked perfectly for me. Hope it will help you guys.
i have faced a similar problem and running yarn set version 1.22.1 fix it
Run the Command Prompt as an administrator. And run the following command:
npx create-expo-app AwesomeProject
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.
i functions: Preparing to emulate functions.
Warning: You're using Node.js v8.10.0 but Google Cloud Functions only supports v6.11.5.
âš functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
âš functions: Error from emulator. Error parsing triggers: Cannot find module '/home/developer/Development/host2/functions'
Try running "npm install" in your functions directory before deploying.
We are new in firebase function , How to solve this issue ?
In many cases, new features and bug fixes are available only with the latest version of the Firebase CLI and the firebase-functions SDK. It's a good practice to frequently update both the Firebase CLI and the SDK with these commands inside the functions folder of your Firebase project:
npm install -g firebase-tools
npm install firebase-functions#latest firebase-admin#latest --save
visit: https://firebase.google.com/docs/functions/get-started
I don't know if my problem was the same as your, but for further reference I will post my solution.
In my case, I was using TypeScript instead of JavaScript, so the code needed to be compiled before run firebase serve.
In your Firebase app directory:
$ cd functions/
$ npm run-script build
$ cd ..
$ firebase serve
The last command maybe need super user permission, so sudo firebase serve.
Optionally you can run npm run-script lint before npm run-script build to check for possible errors if you are using tslint.
In my case the solution was :
1 - Reinstall Node ( version 10.15.0 ). After download node-v8.11.2-x64.msi from node.org
2 - Reinstall firebase-tools ( npm install firebase-tools -g )
3 - Clear cache ( npm cache clear --force )
I was having this problem too. I can't explain how, but it turns out that my firebase.json was not correct. Check the functions section of it and make sure it looks like this:
"functions": {
"source": "functions"
},
Found this SO answer: How to deploy functions from other directory than '/functions'?
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!
I just created a firebase app and written my functions in typescript
import * as functions from 'firebase-functions'
export const onStatementUpload = functions.storage.object().onFinalize(obj => {
console.log('obj finalize', obj)
})
But on deployment:
src/index.ts(10,61): error TS2339: Property 'onFinalize' does not exist on type 'ObjectBuilder'.
I tried to install #types/firebase-functions but theres no such thing. How do I resolve this?
I was running into this issue as well and solved it by upgrading to the latest versions of firebase-functions, firebase-admin, and firebase-tools which added the onFinalize method (which wasn't available in previous versions).
# Make sure you're in your `functions` (or equivalent) directory
$ npm install firebase-functions#latest firebase-admin#latest --save
$ npm install -g firebase-tools
Then try redeploying the app:
$ firebase deploy --only functions