Error: Unable to resolve module on build

Hello,

I get this error when I build my app: eas build -p android

However, everything works fine when I start in development mode : expo run: android

eas.json

{
  "build": {
    "release": {
      "env": {
        "ENVIRONMENT": "production",
        "REACT_APP_URL": "https://prodserver.ch:3001/",
        "REACT_APP_URL_SUFFIX": "/api/v1"
      }
    },

    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "env": {
        "ENVIRONMENT": "development",
        "REACT_APP_URL": "http://192.168.1.127:3000/",
        "REACT_APP_URL_SUFFIX": "/api-dev/v1"
      }
    }
  }
}

app.json

{
  "expo": {
    "name": "insPPEctor",
    "slug": "ins-ppe-ctor",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "2.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "cover",
      "backgroundColor": "#000"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "ch.devalpes.insppector",
      "buildNumber": "2.0.0"
    },
    "android": {
      "package": "ch.devalpes.insppector",
      "versionCode": 2
    },
    "description": ""
  }
}

package.json:

{
  "name": "insppector",
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.0",
    "@react-native-async-storage/async-storage": "^1.15.7",
    "@react-native-community/datetimepicker": "3.5.2",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/slider": "^4.1.6",
    "@react-navigation/bottom-tabs": "^6.0.5",
    "@react-navigation/elements": "^1.1.0",
    "@react-navigation/native": "^6.0.2",
    "@react-navigation/native-stack": "^6.0.6",
    "axios": "^0.21.1",
    "buffer": "^6.0.3",
    "expo": "^42.0.0",
    "expo-barcode-scanner": "~10.2.2",
    "expo-camera": "~11.2.2",
    "expo-dev-client": "^0.5.1",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.8.1",
    "formik": "^2.2.6",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.4",
    "react-native-animatable": "^1.3.3",
    "react-native-appearance": "~0.3.3",
    "react-native-cli": "^2.0.1",
    "react-native-flash-message": "^0.1.23",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-get-random-values": "~1.7.0",
    "react-native-just-timeline": "0.0.2",
    "react-native-paper": "^4.9.2",
    "react-native-reanimated": "~2.2.0",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "3.4.0",
    "react-native-svg": "12.1.1",
    "react-native-switch-selector": "^2.0.6",
    "react-native-unimodules": "~0.14.5",
    "react-native-web": "^0.17.1",
    "react-redux": "^7.2.2",
    "reanimated-bottom-sheet": "^1.0.0-alpha.22",
    "redux": "^4.1.1",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "uuid": "^8.3.2",
    "yup": "^0.32.8",
    "expo-splash-screen": "~0.11.2"
  },
  "devDependencies": {
    "[AT]babel/core": "^7.15.4",
    "babel-preset-expo": "^8.4.1",
    "prettier": "2.3.2",
    "redux-devtools-extension": "^2.13.8"
  },
  "private": true,
  "version": "1.0.0"
}

I hope, I have given enough informations, do not hesitate if you need anything else.

Thanks in advance for your help,

Jack

can you try creating clean repository clone and running expo run:android there?
are you using latest cli?

potential issues that could cause that:

  • some of the files are gitignored(sources or maybe bundler config)
  • if you are on macos filenames are not case sensitive so git state might be different than local fs https://expo.fyi/macos-ignorecase
  • I noticed that you are referring to some of the files in the same directory by ../_actions, maybe try changing that to normalized path (going through the parent dir should still work correctly, but if that is the issue it will help narrow the problem)

Hi @jackair

By the way, you can save yourself some trouble by marking the above sort of stuff as a code block

You can also use the </> button on the formatting toolbar if you select a block of text (as opposed to part of a line).

Hello,

Some weeks ago, I made a mistake in renoming “InspectionsActions.js” to “inspectionsActions.js” it was changed in my local workspace but not in my gitlab repository. That point was the problem, after correction evrything build well for Android and iOS.

I’ve also normailzed some inexact imports.

Your tips really helped me. Thank you so much !

1 Like