npm ERR! Merge conflict detected in your package.json.
npm ERR! Please resolve the package.json conflict to retry the command:
I have tried the npm-merge-driver
but still coming the same error.
npm ERR! Merge conflict detected in your package.json.
npm ERR! Please resolve the package.json conflict to retry the command:
I have tried the npm-merge-driver
but still coming the same error.
The problem is that you might have duplicate keys in your package.json file. To fix it:
1. Open your package.json trace it for duplicate keys. To give you some ease start with the dependencies and devDependencies key.
2. If you find duplicate keys compare and copy and paste the dependencies that are not duplicated into one key and delete the rest.
3. Run npm install
Example: At the start, I had this.
"dependencies": {
"@react-navigation/material-bottom-tabs": "^6.1.1",
"@react-navigation/material-top-tabs": "^6.1.1",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"axios": "^0.26.0",
"eject": "expo eject"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-pager-view": "5.4.9",
"react-native-paper": "^4.11.2",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.1.0",
"react-native-web": "0.17.1",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"twrnc": "^3.0.2"
},
after I compared and remove duplicate dependencies and one of the keys. I got this:
"dependencies": {
"@react-navigation/material-bottom-tabs": "^6.1.1",
"@react-navigation/material-top-tabs": "^6.1.1",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"axios": "^0.26.0",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-pager-view": "5.4.9",
"react-native-paper": "^4.11.2",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.1.0",
"react-native-web": "0.17.1",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"twrnc": "^3.0.2"
},
You can also check your dev dependencies as well. To avoid this problem in the future do not open your package.json file while installing packages.