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"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With