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.
Related
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
I want to enforce eslint rules before commit and I have configured pre-commit in react-native package.js file but it is not showing eslint error on commit. if I run yar run lint works fine.
Below is my Package.js file
{
"name": "test",
"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": "17.0.2",
"react-native": "0.65.1",
"storyblok-js-client": "^4.0.9",
"react-query": "^3.19.1",
"react-redux": "^7.2.4",
"graphql": "^15.5.0",
"graphql-request": "^3.5.0",
"react-native-typography": "^1.4.1",
"rn-fetch-blob": "^0.12.0",
"react-native-webview": "^11.13.0",
"base-64": "^1.0.0"
},
"devDependencies": {
"#babel/core": "^7.15.5",
"#babel/runtime": "^7.15.4",
"#react-native-community/eslint-config": "^3.0.1",
"#typescript-eslint/eslint-plugin": "^4.31.1",
"#typescript-eslint/parser": "^4.31.1",
"babel-jest": "^27.2.0",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.25.1",
"jest": "^27.2.0",
"metro-react-native-babel-preset": "^0.66.2",
"react-native-codegen": "^0.0.7",
"react-test-renderer": "17.0.2",
"#testing-library/react-native": "^7.2.0",
"eslint-plugin-jest": "^24.4.0",
"fetch-mock": "^9.11.0",
"husky": "^7.0.2",
"lint-staged": "^11.1.2",
"typescript-styled-plugin": "^0.18.1"
},
"lint-staged": {
"src/**/*.{ts,tsx, js, jsx}": [
"eslint --ext .tsx --ext .ts src/ --fix"
],
"./src/**": [
"prettier --write ."
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && pretty-quick --staged"
},
"jest": {
"preset": "react-native"
}
}
}
Did you run husky install?
You can also try to add a file named 'pre-commit' to the .husky folder with the following content:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
I am getting an error that #react-navigation/native could not be found within the project. I tried to install it and my package.json file says. I am not sure what to do next to get it running. Cheers {
"name": "sample",
"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-native-community/masked-view": "^0.1.10",
"#react-navigation/native": "^5.5.1",
"#react-navigation/stack": "^5.5.1",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.4",
"react-native-screens": "^2.8.0"
},
"devDependencies": {
"#babel/core": "^7.10.2",
"#babel/runtime": "^7.10.2",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.0.1",
"eslint": "^7.2.0",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
I get that problem sometimes as well, when I restart the app the problem is gone. I don't know why it happens, though.
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"
}
}
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.