How to solve warnings from yarn - react-native

I did already solve:
warning " > react-native#0.54.3" has incorrect peer dependency "react#^16.3.0-alpha.1".
I just edit package.json dependencies:
...
"react": "^16.3.0-alpha.1",
...
and ran yarn.
But how can I solve following warnings:
warning "react-native > metro > #babel/plugin-check-constants#7.0.0-beta.38" has incorrect peer dependency "#babel/core#7.0.0-beta.38".
warning "jest-expo > babel-jest#22.4.3" has unmet peer dependency "babel-core#^6.0.0 || ^7.0.0-0".
my yarn version is 1.5.1
my whole package.json:
{
"name": "#######",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "^25.1.0",
"react-native-scripts": "^1.11.1",
"react-test-renderer": "^16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^6.3.1",
"exp": "^47.4.4",
"expo": "^23.0.4",
"react": "^16.3.0-alpha.1",
"react-native": "^0.54.3",
"react-navigation": "^1.5.8"
}
}

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.

React native custom font not loaded

I'm new to react-native ,
i read a tutorial to import custom font in my project.
my font not working.
here is my project structure:
here is my package.json:
{
"name": "Arvandkala",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.14.0",
"jest-expo": "~27.0.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2"
},
"rnpm": {
"assets": [
"./assets/fonts"
]
}
}
also when i run react-native link i see this message on terminal:
Scanning folders for symlinks in /Users/hamed/Desktop/arvandkala/Arvandkala/node_modules (12ms)
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'pbxprojPath' of null
Please file an issue here: https://github.com/facebook/react-native/issues
Cannot read property 'pbxprojPath' of null
Run this command and try.
react-native upgrade

Unable to resolve "mobx-react/native" from "node_modules/react-native-router-flux/dist/Router.js"

Im using expo.
here's my package.json file
{
"name": "emmunize",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "27.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^6.3.1",
"expo": "^27.0.0",
"firebase": "^5.0.2",
"moment": "^2.22.2",
"native-base": "^2.5.2",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
"react-native-datepicker": "^1.7.2",
"react-native-router-flux": "^4.0.0-beta.32",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0"
}
}
I dont know what happened, when I try to exp start and exp android this error appeaars. I've followed the latest exp version 27 https://blog.expo.io/expo-sdk-v27-0-0-is-now-available-898bf1e5b0e4 but I think react-native-router-flux has an issue with the latest expo version?
I had the same problem when i was create a new project. As this is the new beta we should wait to the group can solve the bug.
Provisional Solution
Open terminal
Go to project path... Example: user/Documents/ReactNative/(name your project)/
run the command: npm remove react-native-router-flux
run the command: npm install react-native-router-flux#4.0.0-beta.28
run project again to try
react-native-router-flux#4.0.0-beta.28 is a version that i used in the last project and work fine.

React Native Version Mismatch Error

I am trying to run a react native application using the following command.
npm run android
I get the following error.
im using nvm - nvm use stable
Now using node v8.9.4 (npm v4.6.1)
**package.json**
{
"name": "client",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.11.0",
"jest-expo": "23.0.0",
"react-test-renderer": "16.0.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^23.0.4",
"react": "16.0.0",
"react-native": "0.50.3"
}
}
A different solution recommended rerunning the build process because there maybe some interference, but this did not work for me.
I managed to solve this my self. The error message was showing a react-native version of 0.50.3.
But the latest version is 0.52 as can be seen here https://facebook.github.io/react-native/versions.html.
So i updated package json to reflect this.
"dependencies": {
"react-native": "0.52"
}
then i deleted npm modules and reran npm install. This fixed my issue.
tldr; update package.json react-native dependency to reflect latest version.
I Had the same problem, and the KHAN give us the right solution.
I'm Putting here the package.json for thoses who need the fix:
{
"name": "project",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.11.0",
"jest-expo": "25.0.0",
"react-test-renderer": "16.0.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.0.0",
"react-native": "0.52"
}
}