callstack / react-native-visionos

A framework for building native visionOS applications using React
https://callstack.github.io/react-native-visionos-docs/
MIT License
977 stars 28 forks source link

No such module 'React_RCTSwiftExtensions' #96

Closed billyjacoby closed 8 months ago

billyjacoby commented 8 months ago

Description

When trying to run the visionos/app.xcworkspace in xcode I receive the build error: No such module 'React_RCTSwiftExtensions'

Steps to reproduce

  1. Init the app by following the readme
  2. Open the visionos xcworkspace file
  3. See the error in the App.swift file

React Native Version

0.73.3

Affected Platforms

Build - MacOS

Output of npx react-native info

info Fetching system and libraries information...
warn Multiple Podfiles were found: ios/Podfile,visionos/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/main/docs/configuration.md
System:
  OS: macOS 14.4
  CPU: (10) arm64 Apple M1 Max
  Memory: 316.30 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 4.1.0
    path: ~/.nvm/versions/node/v18.18.2/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.2/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.0
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.9971841
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

### Stacktrace or Logs

```text
`Module map file '/Users/billyjacoby/Library/Developer/Xcode/DerivedData/rnVision-bfdwviiuqrsrexfaodposxiccucp/Build/Products/Debug-xrsimulator/React-RCTSwiftExtensions/React_RCTSwiftExtensions.modulemap' not found
`

Reproducer

https://github.com/billyjacoby/vision-template

Screenshots and Videos

No response

okwasniewski commented 8 months ago

Hey @billyjacoby,

Just cloned your repro and everything works as it should.

Can you try to clean the native build folder and pods:

cd visionos
rm -rf Pods build

then reinstall pods:

bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

Open the project in Xcode and try to build it. Also make sure you've installed dependencies with yarn

billyjacoby commented 8 months ago

Hmm still seeing the same thing, not sure if this screenshot of the errors in XCode is helpful:

Screenshot 2024-02-06 at 8 13 54 AM
okwasniewski commented 8 months ago

Can you try CMD+K in Xcode (this cleans build folder) if that won't help try to Clear Xcode Derived data

billyjacoby commented 8 months ago

Still nothing, getting the same errors.

billyjacoby commented 8 months ago

One interesting thing I noticed is that when I ran yarn visionos (successfully) i saw this line:

Multiple Podfiles were found: ios/Podfile,visionos/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/main/docs/configuration.md

Which looks like it's using the iOS Podfile instead of the visionos Podfile, could this be related?

okwasniewski commented 8 months ago

Can you share a screenshot of how your built app looks? I need to fix this warning in CLI as it's not really accurate and you should still use visionos Podfile. Also you can try if you can build your app through Xcode now

billyjacoby commented 8 months ago

So this issue that I'm having is building the app through XCode, that's the only time I face this issue.

Here's the built app (without the dev server running)

image

okwasniewski commented 8 months ago

Ah so it's using visionos Podfile, that's great.

Im not sure why you are facing those issues (probably they are only appearing in Xcode.app as building through CLI also uses Xcode build tools and it works). Xcode sometimes is weird so restarting your Mac or something may help here.

billyjacoby commented 8 months ago

Sorry had to start work, but restarting my laptop didn't fix this issue.

okwasniewski commented 8 months ago

Ah, okay I thought it's fixed. So even if you built the app through yarn visionos and then open Xcode and try to build it still shows the same error? Can you also try initializing a new project?

billyjacoby commented 8 months ago

Yeah, yarn visionos then opening XCode shows the same error. Lemme try a new project in a few mins and get back to you. For some reason I get other issues running bundle install when I try this from my work machine

billyjacoby commented 8 months ago

Okay a brand new install seems to work fine, which is super strange because I only initialized the other project this morning right before I opened this 🤔

Saadnajmi commented 8 months ago

A guess: I think cocoapods 1.15 had issues with the cocoapods caches, and doesn't work with React Native at the moment?

billyjacoby commented 8 months ago

Interestingly I'm using 1.15.0 on the machine I eventually got this working on but I can't get this to build on the machine using 1.14.3

billyjacoby commented 8 months ago

Just to further comment here - updating to Cocopods version 1.15.2 seems to have fixed this so it seems that was the culprit.