"Unable to resolve" my own file in React Native

I recently started getting this error which I’d never gotten before:

Failed building JavaScript bundle.
Unable to resolve “…/…/models/Contact” from “components/accounts/Contacts.tsx”

Some clues:

  • I know the paths are correct - this is not a part of the code that changed recently, and it worked fine before
  • It works fine in web, but not iOS or Simulator
  • SDK version 38, CLI version 3.24.0, managed workflow

Any ideas?

why are there three . in the path? …/…
did you mean ../../?

Hey Brent. Hm that happened in the quote formatting. It’s 2 dots in code, and works in web so I know the path is correct.

This is the (indecipherable) stack trace in Expo:

Clicking “extra info” just brings up an empty red screen.

This is the import in question - not sure why the previous line works but not this:

import { db, chunkArray } from '../../apis/firebase'
import { Contact } from '../../models/Contact'
import SetupRow from './SetupRow'

And package dependencies in case it adds any context…

  "dependencies": {
    "@expo/vector-icons": "^10.0.0",
    "@mikro-orm/core": "^4.0.7",
    "@mikro-orm/reflection": "^4.0.7",
    "@mikro-orm/sqlite": "^4.0.7",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "^5.6.1",
    "@react-navigation/native": "^5.6.1",
    "@react-navigation/stack": "^5.6.2",
    "cuid": "^2.1.8",
    "date-fns": "^2.16.1",
    "expo": "^39.0.0",
    "expo-asset": "~8.2.0",
    "expo-constants": "~9.2.0",
    "expo-contacts": "~8.5.0",
    "expo-firestore-offline-persistence": "^0.1.0",
    "expo-font": "~8.3.0",
    "expo-linking": "^1.0.1",
    "expo-splash-screen": "~0.6.1",
    "expo-sqlite": "~8.4.0",
    "expo-status-bar": "~1.0.2",
    "expo-web-browser": "~8.5.0",
    "fast-csv": "^4.3.3",
    "firebase": "7.9.0",
    "fuse.js": "^6.4.1",
    "indexeddbshim": "^7.0.0",
    "native-base": "^2.13.14",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
    "react-native-elements": "^2.2.1",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-paper": "^4.0.1",
    "react-native-safe-area-context": "3.1.4",
    "react-native-screens": "~2.10.1",
    "react-native-web": "~0.13.7",
    "twitter-lite": "^0.14.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "@types/react": "~16.9.35",
    "@types/react-native": "~0.63.2",
    "@typescript-eslint/eslint-plugin": "^3.9.1",
    "@typescript-eslint/parser": "^3.9.1",
    "babel-preset-expo": "^8.3.0",
    "eslint": "^7.7.0",
    "eslint-config-universe": "^4.0.0",
    "jest-expo": "^39.0.0",
    "prettier": "^2.0.5",
    "ts-node": "^9.0.0",
    "typescript": "~3.9.2"
  },

i think it’s probably a lot simpler than you think. maybe you don’t have the correct extension on the file. maybe the casing is incorrect. it’s impossible to say without a reproducible example though.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.