react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Xcode 14.3 - Error: Unable to resolve module ./Libraries/Components/DatePicker/DatePickerIOS

Open mjmasn opened this issue 2 years ago • 92 comments

UPDATE: READ HERE FOR LATEST+WORKAROUND ON THIS.

Description

Since upgrading to Xcode 14.3 and working around the other new issues i.e. the codegen ios target version issue, there is still a further issue with metro. Getting a lot of these type of errors. It seems to be every time metro logs a log line from iOS (not Android), it then logs the below message as well (full paths redacted).

This seems to cause a memory leak as well, with the metro node process eventually crashing when > 4GB RAM is used.

The error message is interesting for many reasons.

  1. Firstly it seems to be trying to resolve a flow type import.
  2. Secondly the path does exist, but metro is not checking the platform-specific path i.e. DatePickerIOS.ios.js.
  3. Thirdly we don't even use DatePickerIOS in the app.

None of these files exist:
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.engine.js|.engine.js)
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.engine.js|.engine.js)
  15 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  16 | import typeof Button from './Libraries/Components/Button';
> 17 | import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS';
     |                                   ^
  18 | import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
  19 | import typeof FlatList from './Libraries/Lists/FlatList';
  20 | import typeof Image from './Libraries/Image/Image';
    at ModuleResolver.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:107:15)
    at DependencyGraph.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph.js:288:43)
    at Object.resolve (node_modules/metro/src/lib/transformHelpers.js:129:24)
    at resolve (node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
    at node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
    at Array.reduce (<anonymous>)
    at resolveDependencies (node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
    at processModule (node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
    at async addDependency (node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
    at async Promise.all (index 9)

NOTE that this is not the codegen ios target version issue, I've already worked around that using the patch which has been released as 0.70.8

React Native Version

0.70.6

Output of npx react-native info

System:
    OS: macOS 13.3
    CPU: (8) arm64 Apple M1 Pro
    Memory: 1.78 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
    Yarn: 1.22.19 - ~/redacted/node_modules/.bin/yarn
    npm: 8.0.0 - ~/redacted/node_modules/.bin/npm
    Watchman: 2023.02.27.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /redacted/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.4.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.67.1 => 0.67.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Running a previously working app on Xcode 14.3 / iOS simulator with rosetta

Snack, code example, screenshot, or link to a repository

Can't provide one at this stage

mjmasn avatar Apr 04 '23 10:04 mjmasn

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

github-actions[bot] avatar Apr 04 '23 10:04 github-actions[bot]

The same issue is happening for me on version 0.71.6 of react-native and version 14.3 of Xcode.

dmontag23 avatar Apr 04 '23 13:04 dmontag23

Got the same issue, also version 0.71.6 Xcode 14.3

cchampou avatar Apr 04 '23 14:04 cchampou

I'm having the same issue, I'm on version 0.69.9 and XCode 14.3

focux avatar Apr 04 '23 15:04 focux

Started going down that rabbit hole too

Error: Unable to resolve module ./Libraries/Components/DatePicker/DatePickerIOS from `/xxx/node_modules/react-native/index.js: 

None of these files exist:
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.svg|.svg)
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS/index(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx|.native.svg|.svg)
  15 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  16 | import typeof Button from './Libraries/Components/Button';
> 17 | import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS';
     |                                   ^
  18 | import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
  19 | import typeof FlatList from './Libraries/Lists/FlatList';
  20 | import typeof Image from './Libraries/Image/Image';

Xcode v14.3 React Native 0.70.6 Build Target iOS 14.0

Architecture: Apple Silicon (M1 Max)

Had to manually change the iOS Deployment Target of Pods > React-Codegen to iOS 12.4 or otherwise it won't build.

Steps to reproduce:

  • Build and run with the aforementioned configuration.
  • Navigate around your app.
  • Metro eventually produces a memory leak on node (I'm using nvm) image

nvictor-acv avatar Apr 04 '23 16:04 nvictor-acv

:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

github-actions[bot] avatar Apr 04 '23 16:04 github-actions[bot]

Same here, I'm on React Native 0.70.5 and XCode 14.3.

This error appears whenever there is any other type of error on the app, and eventually crashes with a memory leak.

cristianmacedo avatar Apr 04 '23 18:04 cristianmacedo

Same issue, React native 0.70.5 and XCode 14.3.

avdhhh avatar Apr 04 '23 18:04 avdhhh

same issue

abanik0831usc avatar Apr 04 '23 18:04 abanik0831usc

same issue

epweil avatar Apr 04 '23 19:04 epweil

Fixed with npx react-native upgrade

epweil avatar Apr 04 '23 19:04 epweil

Same issue

daviddalmaso avatar Apr 05 '23 01:04 daviddalmaso

Same issue

cankilinc avatar Apr 05 '23 07:04 cankilinc

I had this issue too. This is a very serious problem. I hope this can be resolved as soon as possible.

expo: 46 -> 48 react native: 0.69.4 -> 0.71.6

s-kuniyoshi avatar Apr 05 '23 07:04 s-kuniyoshi

Same issue react-native: 0.64.1 xcode: 14.3

usescrt avatar Apr 05 '23 09:04 usescrt

Same issue react-native: 0.69.5 xcode: 14.3

dsshard avatar Apr 05 '23 10:04 dsshard

Xcode -> Pods -> Build Settings -> Ios Deployment Target change to 12.4 and will work! 🔥

cankilinc avatar Apr 05 '23 10:04 cankilinc

I downgraded xcode version to 14.2 it helped.

  1. Go to apple developer and download version 14.2
  2. Set 14.2 version Screenshot 2023-04-05 at 13 41 01 Enjoy.

AND-GORNIY avatar Apr 05 '23 10:04 AND-GORNIY

Same issue React native : 0.70.8 (release yesterday) Xcode : 14.3

Tibze avatar Apr 05 '23 12:04 Tibze

same issue React Native: 0.70.5 Xcode: 14.3

hcbylmz avatar Apr 05 '23 12:04 hcbylmz

Same issue expo 47.0 react native 0.70.5 xcode 14.3

dglalperen avatar Apr 05 '23 12:04 dglalperen

Same over here.

Xcode 14.3

ivela avatar Apr 05 '23 14:04 ivela

Same issue here Xcode 14.3

Jaoued-mtd avatar Apr 05 '23 14:04 Jaoued-mtd

Same issue with Xcode 14.3

tmeyer24 avatar Apr 05 '23 14:04 tmeyer24

Same issue Here with Xcode 14.3

j-khong avatar Apr 05 '23 14:04 j-khong

Same issue with Xcode 14.3

AndriiHnedko avatar Apr 05 '23 15:04 AndriiHnedko

Same issue with a multitude of packages.

stephendaddario avatar Apr 05 '23 15:04 stephendaddario

You can downgrade to Xcode 14.2 to solve this issue:

gem install xcode-install
xcversion install 14.2
xcversion select 14.2

It will install the app Xcode-14.2 that you can use to start your app.

In my case changing the command line tools to 14.2 was not enough and it was critical to launch Xcode-14.2 and not the normal Xcode app that was at version 14.3.

nassim-yagoub avatar Apr 05 '23 15:04 nassim-yagoub

downgrading to Xcode 14.2

Unfortunately, this is not gonna work when you are on Ventura, which requires the latest Xcode version 14.3

kris-presentpal avatar Apr 05 '23 16:04 kris-presentpal

any news? I'm having the same issue

luluanacarla avatar Apr 05 '23 17:04 luluanacarla