Reputation: 7355
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?
Upvotes: 8
Views: 16431
Reputation: 799
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.
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
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 [email protected]
or npm install react-native@version
Upvotes: 0
Reputation: 2071
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.
Upvotes: 5
Reputation: 1093
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
Upvotes: 2
Reputation: 1093
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
Upvotes: 7