Trying to uninstall rn-fetch-blob - react-native

I am having issues uninstalling.
I have run rm -rf node_modules, yarn and react-native link, and then removed compile project(':rn-fetch-blob') from build.gradle, as other question suggested, but now I am getting more errors in the source code for Android when I try to run react-native run-android (probably will happen for iOS too).
> Task :app:compileDebugJavaWithJavac FAILED
/.../MainApplication.java:6: error: package com.RNFetchBlob does not exist
import com.RNFetchBlob.RNFetchBlobPackage;
^
/.../MainApplication.java:29: error: cannot find symbol
new RNFetchBlobPackage(),
^
symbol: class RNFetchBlobPackage
2 errors
I need help. This module feels like malware.

Best bet is to look at the manual installation steps for rn-fetch-blob and do the opposite of what they are saying
https://github.com/joltup/rn-fetch-blob/blob/master/README.md#user-content-installation
Manual installation instructions
https://github.com/joltup/rn-fetch-blob/wiki/Manually-Link-Package#index

I exactly did the opposite of installation and it worked

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

How to fix bundler module resolution issue without deleting/installing npm packages?

Goal: successfully build & bundle react native project using react-native-agora v3.0.1-rc.4, while preserving npm packages that i have edited.
I was told to try updating to this version by agora support staff. after a bunch of errors and managing them, I come to another issue. the project now builds, but won't successfully bundle. bundle process fails (on iOS, haven't tried android yet):
error: bundling failed: Error: Unable to resolve module `./AgoraView.native` from `node_modules/react-native-agora/lib/index.js`:
None of these files exist:
* node_modules/react-native-agora/lib/AgoraView.native(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
* node_modules/react-native-agora/lib/AgoraView.native/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
RN v0.61.5
Im not sure why its trying to resolve ./AgoraView.native. As I dont have it explicitly referenced anywhere.
So far ive tried:
npm cache clean --force
uninstalling and reinstalling react-native-agora
pod install
cleaning build folder and rebuilding
How to resolve?
Did you try to delete node_modules and re-install it and clean build folder of iOS. I think it cached the last version of react-native-agoro.
An option if you have edited npm packages, and thus would prefer to avoid deleting, re-installing, and re-editing said packages this is what worked for me:
react-native start --reset-cache

Issue building for android: package io.devshot.rnmaterial does not exist

I am currently trying to build my react native project for android, but I am running into this error:
MainApplication.java:7: error: package io.devshot.rnmaterial does not exist
import io.devshot.rnmaterial.RNMaterialPackage;
I have tried to search for what package I need to install, but I can't seem to find anything.
I am not sure where the issues is coming from in the code, as this just appeared after upgrading to the newest version of react.
try to delete the node_module, reinstall and link again
rm -rf node_modules && npm install && react-native link

react-native link can't find my MainApplication.java file

Every time I try to react-native link a new library, I get the same error message. Here it is for react-native-video.
rnpm-install info Linking react-native-video android dependency
rnpm-install ERR! Something went wrong while linking. Error: ENOENT: no such file or directory, open '/Users/Me/Projects/myProject/android/app/src/main/java/com/companyName/appName/MainApplication.java'
Please file an issue here: https://github.com/facebook/react-native/issues
The actual location of my MainApplication.java file is
./android/app/src/main/java/com/appName/MainApplication.java
The difference is that React Native Link is including "company name" in the path, which doesn't match my project.
How can I fix this?
I looked over some topic and found solution, you can try with:
npm install --save-dev babel-plugin-module-resolver
and then add your npm install package & react-native link again.
Good luck
I'm pretty late to the party on this, but for future reference;
TLDR: Adding another folder like so java/com/companyName/AppName/ will fix your issue.
After updating to the latest react-native I had this issue too. Your android path contains your apps ID so com.test.app path should be android/app/src/main/java/com/test/app.
Looking at your error message, its actually telling you where it's expecting the file to be;
Error: ENOENT: no such file or directory, open '/Users/Me/Projects/myProject/android/app/src/main/java/com/companyName/appName/MainApplication.java'
If you create another folder like so java/com/companyName/AppName/ you will be able to automatically link plugins.
Another way I tried and it works for me:
rm -rf node_modules && npm install
Then retry install your package:
ex:
npm install react-native-image-picker#latest --save
Then react-native link your package
react-native link react-native-image-picker
There are only two options that i am aware of to solve this problem
close all the terminals to stop the node server running on a difference terminal.
If you still have the mistake after that then try the following option
You might still have the error because you uninstall and re-install react-native without paying attention to the version that you installed which for most case will be the latest version. So double check the current version of your react-native when installing it. "\n"
so either
in your package.json you add "react-native": "^0.60.5" if the version is 0.60.5 replace "^0.60.5" by the version you are trying to run, in devDepencies and run npm install
or
run npm install react-native#0.60.5 or npm install react-native#version

Failed to run react-native link on my project

When I run react-native link on my RN project, I got below error:
$ react-native link
rnpm-install ERR! ERRPACKAGEJSON No package found. Are you sure it's a React Native project?
Cannot read property '_text' of undefined
I have searched that some people say run react-native upgrade will resolve this issue. I have tried but no lock. My react version is shown as below:
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.39.2
How can I solve this issue?
Follow below steps in order -
npm cache clean or yarn cache clean
rm -rf node_modules
yarn install or npm install
react-native upgrade ( You can choose no in all steps)
react-native link
If you get permission related error use sudo with all commands.
A little late but this may help someone else. My problem was large commented out copies of <manifest> ... </manifest> in android/app/src/main/AndroidManifest.xml. Once I removed commented out copies, link worked as expected.
It seems xmldoc had touble parsing the manifest even though the AndroidManifest.xml was valid XML. Calling react-native link uses ../node_modules/react-native/local-cli/core/android/index.js. To debug such issues in future I would start with putting debugging statements in ../node_modules/react-native/local-cli/core/android/index.js and narrow down to the root cause of the issue. Similar logic should work for ios.
For me cleaning the gradle did the trick.
1- Go to the root directory of the project.
2- Run cd android
3- Run gradlew clean
4- Run cd..
and then run the link commands
i had this problem. i fixed it with following way:
1- edit "/android/app/src/debug/AndroidManifest.xml"
2- add package="com.YOUR PACKAGE NAME" inline manifest tag. like:
<manifest package="com.YOUR PACKAGE NAME"
note: replace "YOUR PACKAGE NAME" with your package. you can find it in "/android/app/src/main/AndroidManifest.xml"
3- cd android
4- ./gradlew clean
5- cd ../
6- react-native link
try to go android -> src -> main -> AndroidManifest.xml and delete all comments here. After that rerun react-native link, and all is working for me. Good luck!