development Server isn't starting - react-native

i am facing this issue for quite some times. i've created a new project but while starting the server by typing npm start or react-native start in terminal i am getting this output instead of starting server. While in old project development server started successfully. Can anybody tell what's the problem here?
The output when i try to run my project is:
BUILD SUCCESSFUL in 1s info Connecting to the development server... error Failed to install the app on the device. Run CLI with --verbose flag for more details.
here is my package.json
{
"name": "ReduxDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.11.0",
"react-native": "0.62.1"
},
"devDependencies": {
"#babel/core": "7.9.0",
"#babel/runtime": "7.9.2",
"#react-native-community/eslint-config": "0.0.5",
"babel-jest": "24.9.0",
"eslint": "6.8.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}

Related

`native-base` .However, this package itself specifies a `main` module field that could not be resolved

Error: While trying to resolve module native-base from file C:\Users\byambadorj\Desktop\LoginEx\src\LoginScreen.js, the package C:\Users\byambadorj\Desktop\LoginEx\node_modules\native-base\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (C:\Users\byambadorj\Desktop\LoginEx\node_modules\native-base\src\index. Indeed, none of these files exist
C:\Users\byambadorj\Desktop\LoginEx\node_modules\native-base\src\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
C:\Users\byambadorj\Desktop\LoginEx\node_modules\native-base\src\index\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at DependencyGraph.resolveDependency (C:\Users\byambadorj\Desktop\LoginEx\node_modules\metro\src\node-haste\DependencyGraph.js:311:17)......
This is my package.json
{
"name": "LoginEx",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-navigation/native": "^6.0.6",
"native-base": "^3.2.2",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1",
"react-native-size-matters": "^0.4.0"
},
"devDependencies": {
"#babel/core": "7.16.7",
"#babel/runtime": "7.16.7",
"#react-native-community/eslint-config": "2.0.0",
"babel-jest": "26.6.3",
"eslint": "7.14.0",
"jest": "26.6.3",
"metro-react-native-babel-preset": "0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
Try stopping metro and restart it by clearing cache.
npm start --reset-cache

Cannot find module '#babel\runtime\package.json'

I tried to run my app, but suddenly I have given this error.
warn Package #babel/runtime has been ignored because it contains invalid configuration. Reason: Cannot find module '#babel\runtime\package.json'
but I have #babel\runtime in package.json
here is package.json's file
{
"name": "rasa",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"deprecated-react-native-listview": "0.0.6",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-responsive-dimensions": "^3.1.1"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
How can I fix it, I don't want to initialize my project again, is there anyway to fix this problem?
Maybe try npm install in command line and run again.

The method or property expo-file-system.downloadAsync is not available on android, are you sure you've linked all the native dependencies properly?

I am a newbie with react-native.
I am trying to add expo icons, and when the project is running on the device I get this error:
Screenshot with logs
{
"name": "TrackYourFitness",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"expo": "^36.0.2",
"react": "16.9.0",
"react-native": "0.61.5"
},
"devDependencies": {
"#babel/core": "^7.8.3",
"#babel/runtime": "^7.8.3",
"#react-native-community/eslint-config": "^0.0.6",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"eslint": "^6.8.0",
"eslint-plugin-flowtype": "^4.6.0",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
I tried yarn react-native link, but it didn't work.
How can I fix it? Thanks in advance!
According to your error message, you are trying to call the method downloadAsync from the package expo-file-system.
This package is missing in your package.json.
To install it: run the following command:
expo install expo-file-system
But I don't think this is related to your problem, because you're talking about icons. Icons package is already included in Expo, so it will work.
For reference: https://docs.expo.io/versions/latest/guides/icons/
run
npm install react-native-unimodules
npx pod-install //for ios
made changes in your android file based on IOS and Android
see link
https://docs.expo.io/bare/installing-unimodules/
restart react-native again...
npm start
npx react-native run-android
Happy Coding!!!

An error occurs when creating a lower version react-native

I tried to use react-native-beacons-manger to use beacons in react native, but I got an error. So I try to create lower version react-native and run. But it made an error.
$ react-native init BeaconTest --version 0.59.0
$ react-native run-ios
An error looks like
Failed to load bundle(http://localhost:801/index.bundle?platform=ios&dev=true&minify=false with error:(Could not connect to development server)
my package.json file
{
"name": "BeaconTest",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.0"
},
"devDependencies": {
"#babel/core": "^7.7.2",
"#babel/runtime": "^7.7.2",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.57.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
I also tried
$ react-native init Test
$ npm install react-native#0.59.0
but it also made some errors
please let me know how to create low version react-native so that I can use beacon package (react-native-beacons-managers)

There is no QRCode on terminal when type npm start

I type command create-react-native-app <My package name>
then i type npm start i can see QRCode shows on my terminal
But when i type npm run eject for my project
I type npm start again. There's no QRCode show on my terminal any more.
I looking for some answer still can't fix it. It confused with me a lot.
Here is my environment:
Mac OS:10.13.4
{
"name": "TestMovie2",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-react-native-stage-0": "^1.0.1",
"eslint-config-rallycoding": "^3.2.0",
"jest": "^22.4.3",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"#shoutem/animation": "^0.12.2",
"#shoutem/ui": "^0.23.4",
"react": "16.3.0-alpha.1",
"react-native": "0.54.0"
}
}
Hope you have solved the problem , but anyone still facing the problem can just type expo start instead of npm start