I am using native base for making app in react-native. I am new to both things. When I run the app It gives me this error:
Here is my code:
export default class Point extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
</Container>
);
}
}
Here is the screenshot of my versions
and nativebase version is "native-base": "^2.1.2"
This question is related to
react-native
native-base
Deleting node_modules and reinstalling it fixed the error(or at least gave me more specific ones)
In my case, trying npm start -- --reset-cache
and getting a bunch more errors, I deleted (uninstalled) the app from iOS and Android and yarn ios
yarn android
did the trick. (If this does not work for you, please kindly DO NOT give me a thumb down. Encourage people to speak, do not discourage them.)
In my case, I didn't import a module in a component that I was using it in.
So, just check if you are importing the module you want to use...
What worked for me was to just stop the node server running and run 'react-native run-ios' once again
For me, restarting my computer appears to be enough to clear this issue.
It's often required after I've switched between branches, or merged branches using git.
I am using Expo
In my case, I resolved the issue by adding the following code in app.json
file
"expo":{
...
"android": {
"package": "com.mycompanyname.myappname
}
}
I tried killall -9 node
command in terminal
then again i run my project using npm start
and it's working fine
Just kill all node process and start npm server and run application:
Step1: run command killall -9 node
For windows users, run:
taskkill /im node.exe
Run
taskkill /f /im node.exe
if the process still persists.
Step2: run command npm start --reset-cache
Step3: run command react-native run-ios
OR react-native run-android
One of the libraries has not been linked. To check, just comment out in the package.json one by one the latest libraries added.
yarn remove libraryName.
Then run the app with xcode and puf !
1.Close Emülator
2.npm start -- --reset-cache
3.XCode -> Product -> Clean Build Folder
4.npx react-native run-ios
Worked for me for below version and on iOS
"react": "16.9.0",
"react-native": "0.61.5",
Step to resolve Close the current running Metro Bundler Try Re-run your Metro Bundler and check if this issue persists
Hope this will help !
Simply Restart Your Code Editor.
If you are using windows and running yarn open cmd on admin mode' terminate and Restart the node process by typing this command.
Find the node: killall -9 node force to kill : taskkill /f /im node.exe Reset the cache : yarn start --reset-cache
Navigate to your project directory: cd myapp Re-Run your App : yarn android
import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('your app name', () => point);
you just need to close the metro server by control + c and then restart by npm start
Note: If that too doesn't work then just restart your computer, it'll definitely work then.
You should have this at the bottom of the index.ios.js
file
AppRegistry.registerComponent('Point', () => Point);
and also import AppRegistry
from react-native
Closing the current Metro Bundler and restarting by resetting the cache worked for me
npm start -- --reset-cache
I was also suffering from the same error for windows OS. I resolved this by cleaning gradlew
.
The steps are:
cd android
gradlew clean
cd..
Just closing the metro bundler and rebuilding the app done my job.
Ok guys, here we are my solution for this issue:
npm install native-base@latest -g
npm install react-native@latest -g
change package.json for these dependencies
delete node_modules and npm install
Open it Xcode and Build/Run from scratch
I hope it helped
simply run below command.
react-native start --reset-cache
I have solved it, just closing the current Metro Bundler and restarting by type comment below.
npm start -- --reset-cache
Need to replace
.setJSMainModulePath("index") with .setJSMainModulePath("index.android")
I had this issue - it was odd because I reset my repo to a time when the app was working. The issue was with my simulator (iOS).
For me the solution was to
The solution is very simple just kill all the running nodes and restart your node server and rebuild your native application and it works.
For Linix:
killall -9 node
For Windows:
taskkill /im node.exe
For Android native App:
react-native run-android
For IOS native App:
react-native run-ios
Then finally,
npm start
Source: Stackoverflow.com