react-nativeexponpm-installpackage.jsoneas

Expo SDK 51 breaks npm install


I migrated to SDK51, resulting in the npm install process breaking in the EAS build during the installation phase. Seems like @expo/webpack-config and expo have depency issues.

my package.json:

  "dependencies": {
    "@expo/webpack-config": "^19.0.1",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/slider": "4.5.2",
    "@react-native-firebase/app": "^18.9.3",
    "@react-native-firebase/auth": "^18.9.3",
    "@react-native-picker/picker": "2.7.5",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@testing-library/react": "^14.2.1",
    "axios": "^1.6.5",
    "bad-words": "^3.0.4",
    "base-64": "^1.0.0",
    "date-fns": "^3.3.1",
    "dotenv": "^16.3.1",
    "expo": "^51.0.8",
    "expo-app-loading": "^2.1.1",
    "expo-dev-client": "~4.0.14",
    "expo-device": "~6.0.2",
    "expo-image-picker": "~15.0.5",
    "expo-linking": "~6.3.1",
    "expo-notifications": "~0.28.3",
    "expo-splash-screen": "~0.27.4",
    "expo-status-bar": "~1.12.1",
    "firebase": "^10.7.1",
    "google-auth-library": "^9.4.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.1",
    "react-native-chart-kit": "^6.12.0",
    "react-native-charts-wrapper": "^0.6.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-image-picker": "^7.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-modal": "^13.0.1",
    "react-native-numeric-input": "^1.9.1",
    "react-native-paper": "^5.8.0",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "4.10.1",
    "react-native-screens": "3.31.1",
    "react-native-svg": "15.2.0",
    "react-native-web": "~0.19.10",
    "react-router-native": "^6.21.1",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "@babel/core": "^7.24.5",
    "@babel/eslint-parser": "^7.23.3",
    "@babel/preset-env": "^7.24.5",
    "@babel/preset-react": "^7.24.1",
    "@testing-library/jest-native": "^5.4.3",
    "@testing-library/react-native": "^12.4.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "babel-jest": "^29.7.0",
    "detox": "^20.18.1",
    "eslint": "^8.56.0",
    "eslint-plugin-jest": "^27.6.3",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-native": "^4.1.0",
    "jest": "^29.7.0",
    "jest-expo": "~51.0.2",
    "react-test-renderer": "^18.2.0",
    "ts-jest": "^29.1.2"
  },

Running npm install results in the following error:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @expo/webpack-config@19.0.1
npm error Found: expo@51.0.8
npm error node_modules/expo
npm error   expo@"^51.0.8" from the root project
npm error   peer expo@"*" from expo-splash-screen@0.17.5
npm error   node_modules/expo-app-loading/node_modules/expo-splash-screen
npm error     expo-splash-screen@"~0.17.0" from expo-app-loading@2.1.1
npm error     node_modules/expo-app-loading
npm error       expo-app-loading@"^2.1.1" from the root project
npm error   18 more (expo-application, expo-asset, expo-constants, ...)
npm error
npm error Could not resolve dependency:
npm error peer expo@"^49.0.7 || ^50.0.0-0" from @expo/webpack-config@19.0.1
npm error node_modules/@expo/webpack-config
npm error   @expo/webpack-config@"^19.0.1" from the root project
npm error
npm error Conflicting peer dependency: expo@50.0.18
npm error node_modules/expo
npm error   peer expo@"^49.0.7 || ^50.0.0-0" from @expo/webpack-config@19.0.1
npm error   node_modules/@expo/webpack-config
npm error     @expo/webpack-config@"^19.0.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

I have tried deleting node_modules and doing npm install in my local development enviroment, the problem is repeated there aswell now.

I am expecting the npm install to work so that my expo go and EAS build works


Solution

  • Had this same issue and spent hours trying to resolve it. All you need to do is to remove @expo/webpack-config from package.json. eas build should work after that. I assume you have metro installed already (replaces webpack). See package.json and check you have @expo/metro-config or similar there and your good to go after removing @expo/webpack-config line from the file.