Invariant Violation: Native module cannot be null - react-native

Hi I have an error when I am trying to install and import expo-notifications. I followed the documentation here: https://docs.expo.io/versions/v38.0.0/sdk/notifications/ and ran expo install expo-notifications but I am receiving this error when I try to import it. I know the error comes from this import as when i comment it out, my app loads normally. I am using the expo managed workflow. Appreciate if anyone can help me with this issue! Edit: tested it on android simulator and it works there so this seems to be an IOS issue.

Managed to get it working by upgrading from expo sdk 37 to expo sdk 38 by running expo upgrade

Looks like there is an open issue on Github. Try this:
1.delete node_modules & package-lock.json
2.npm cache clean --force
3.npm install --save #react-native-community/push-notification-ios
https://github.com/react-native-community/push-notification-ios/issues/43#issuecomment-625020674

Related

Warning: Invalid version react-native#0.64.2 for expo sdkVersion 43.0.0. Use react-native#0.64.3

I am working on an expo project and everything is working fine, but I began to get a warning message when android is building as
Warning: Invalid version react-native#0.64.2 for expo sdkVersion 43.0.0. Use react-native#0.64.3
The app is still running fine but I don't how to fix this error yet and I want to know if it won't cause an issue later.
I have tried to run npx react-native upgrade 0.64.3 but it didn't work, I got this error
info Fetching diff between v0.64.2 and v0.64.3... error Fetch request
failed with status 404: 404: Not Found. error Failed to fetch diff for
react-native#0.64.3. Maybe it's not released yet?
changing the version of react-native manually in the package.json and run expo install worked for me
I use the expo doctor command it allows diagnose issues with the project.
I would recommend using the expo upgrade command. It upgrades the project packages and config for the given SDK version.
More to find here.
I just faced the same issue. Basically it's telling you should use a higher version of your react-native. I solved it just by updating it to the specified version.
npx react-native upgrade 0.64.3
More info here.
Cheers,
If as in my case one need a specific version of react-native, let's say older because some legacy dependencies in a particular project that for some reason can't be upgrade, then change the version in the package.json won't work.
What worked as the cli suggested is to use:
expo doctor --fix-dependencies
That installed the correct lower version of react-native
To find out actual problems run this command :
expo doctor
To solve all problems regarding package conflicts run this command:
expo doctor --fix-dependencies
Use sudo on Unix based OS if you have permission issue to run those commands.
To solve the error, I used the below command:
npm install react-native-clean-project --save-dev
It is a library that allows us to resolve conflicts.
This library is added to your dependencies.
This handles the problem and if it is not the case add this command:
react-native clean-project-auto

the development server returned 500 react native

I started a new react-native project and I suddenly got this error for no reason and every time I add a package the app can't read and it shows an error for that package for example react-navigation. I tried reinstalling the app countless times but the problem never got fixed.
package.json
You have to install react-native-gesture-handler.
yarn add react-native-gesture-handler
or
npm install react-native-gesture-handler

Struggling to set up nativebase in a React Expo project

I have tried so many different ways to set nativebase up with expo and am still having an issue. At the moment I'm using the
Getting Started documentation found on the nativebase website.
I first create a new app with expo using
expo init myapp
Then I install nativebase using
npm install native-base --save
Then I finally install the font
expo install expo-font
I even copy the App.js found in the getting started documentation, and after I start the app and try to run it on an emulator I face the below error
Unable to resolve "#expo/vector-icons/Fontisto" from "node_modules\native-base\dist\src\basic\IconNB.js"
Failed building JavaScript bundle.
What am I missing? Coming from .NET world this whole process with dependencies is so painful...
*Edit 1
I'm sure someone will make mention of the fact that the error message mentions #expo/vector-icons and I have not installed that. When running before I install this package I get that error, and after I install the mentioned package I still face the exact same error.
Please try with this version of native base :
npm i --save-exact native-base#2.13.8
Expo should release a version with that version .
Hope it helps. feel free for doubts
We can run the below command with Expo
npm i --save-exact native-base#2.13.8
Still this version is not available, but its working, really don't know why?

Graphql error when building react-native app

I'm getting this error on node when I try and npm run android my react native app
Unable to resolve "./printError" from
"node_modules/graphql/error/index.js
The error only occurs when attempting to import any libraries that require Graphql. Graphql is installed, and I've uninstalled and reinstalled my node_modules several times attempting to fix this but nothing works. Any help would be appreciated.
printError was added with v0.12.0. Apollo requires at least v14.5.4. You can install the latest version with npm install graphql#latest.

Expo Developer Tools is disconnected from Expo CLI. Cannot find module './validators/Presets'

i'm new to react-native. i've been tryin to set up a new react-native project, but seems to have some problem. I saw many questions similar to this, but none of it is relevent to the issue i'm experiencing..
i've installed and created expo as per documentation.
npm i -g expo-cli
expo init testproject
cd testproject
but when i expo start, the above error occurs
npm: 6.9.0
node: 12.1.0
expo: 2.15.4
expo diagnostics:
as per guidance mentioned by
#AddWeb Solution Pvt Ltd
, i was able to fix the issue.
thanks..
for anyone stumbling with the same issue in future, i'm leaving the answer here.
The problem is with linux O.S. it's case-sensitive. so the fix is to manually edit
'Colors' to 'colors' and 'Presets' to 'presets' which is shown in the below image