Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS build failing on fresh react native project #35712

Open
benjamineruvieru opened this issue Dec 24, 2022 · 9 comments
Open

iOS build failing on fresh react native project #35712

benjamineruvieru opened this issue Dec 24, 2022 · 9 comments
Labels

Comments

@benjamineruvieru
Copy link

Description

npm run android has been failing on a fresh react native project

Screen Shot 2022-12-24 at 7 52 44 AM

Full Error Link

I have tried sooo many things none worked, I feel so helpless now

Version

0.70.6

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 11.6.8
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 127.79 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: Not Found
npm: 9.2.0 - ~/.nvm/versions/node/v18.12.1/bin/npm
Watchman: 2022.12.12.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/mac/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 28, 29, 31, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1
System Images: android-24 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-31 | Intel x86 Atom_64, android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.6 => 0.70.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Install a new project
npx react-native init Name

npm run iOS

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

npx react-native init Name

@benjamineruvieru
Copy link
Author

Its also worth noting that if I run pod install with this command
RCT_NEW_ARCH_ENABLED=1 pod install

I get this error
Screen Shot 2022-12-24 at 8 27 30 AM

Which is the same error I get when I run
npm run iOS
on any of my react native project so currently, I can't build iOS on my old projects and I can't create a new project

I have tried deleting derived data
Clearing cache
Deleting node modules and Pods

I even deleted node,cocoapods, watchman, and everything related to react native and did a new install

Yet same issue

@benjamineruvieru
Copy link
Author

I just tried using expo prebuild
And I am getting same error

Screen Shot 2022-12-24 at 9 30 15 AM

expo run:ios

› Planning build
› Compiling react-native Pods/React-RCTVibration » RCTVibration.mm

❌ (node_modules/react-native/Libraries/Vibration/RCTVibration.mm:16:28)

14 | #import "RCTVibrationPlugins.h"
15 |

16 | @interface RCTVibration()
| ^ cannot find protocol declaration for 'NativeVibrationSpec'
17 | @EnD
18 |
19 | @implementation RCTVibration

❌ (node_modules/react-native/Libraries/Vibration/RCTVibration.mm:33:20)

31 | }
32 |

33 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ use of undeclared identifier 'facebook'
34 | {
35 | return std::make_sharedfacebook::react::NativeVibrationSpecJSI(params);
36 | }

❌ (node_modules/react-native/Libraries/Vibration/RCTVibration.mm:33:72)

31 | }
32 |

33 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ use of undeclared identifier 'facebook'
34 | {
35 | return std::make_sharedfacebook::react::NativeVibrationSpecJSI(params);
36 | }

❌ (node_modules/react-native/Libraries/Vibration/RCTVibration.mm:35:27)

33 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
34 | {

35 | return std::make_sharedfacebook::react::NativeVibrationSpecJSI(params);
| ^ use of undeclared identifier 'facebook'
36 | }
37 |
38 | RCT_EXPORT_METHOD(vibrateByPattern:(NSArray *)pattern

› Compiling react-native Pods/React-RCTSettings » RCTSettingsManager.mm

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:18:34)

16 | #import "RCTSettingsPlugins.h"
17 |

18 | @interface RCTSettingsManager()
| ^ cannot find protocol declaration for 'NativeSettingsManagerSpec'
19 | @EnD
20 |
21 | @implementation RCTSettingsManager

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:55:14)

53 | }
54 |

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
| ^ no member named 'react' in namespace 'facebook'
56 | {
57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
58 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:55:4)

53 | }
54 |

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
| ^ expected a type
56 | {
57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
58 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:60:14)

58 | }
59 |

60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants
| ^ no member named 'react' in namespace 'facebook'
61 | {
62 | return facebook::react::typedConstantsJS::NativeSettingsManager::Constants({
63 | .settings = RCTJSONClean([_defaults dictionaryRepresentation])

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:60:4)

58 | }
59 |

60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants
| ^ expected a type
61 | {
62 | return facebook::react::typedConstantsJS::NativeSettingsManager::Constants({
63 | .settings = RCTJSONClean([_defaults dictionaryRepresentation])

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:115:30)

113 | }
114 |

115 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ no member named 'react' in namespace 'facebook'
116 | {
117 | return std::make_sharedfacebook::react::NativeSettingsManagerSpecJSI(params);
118 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:115:82)

113 | }
114 |

115 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ no member named 'react' in namespace 'facebook'
116 | {
117 | return std::make_sharedfacebook::react::NativeSettingsManagerSpecJSI(params);
118 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:57:21)

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
56 | {

57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
| ^ no member named 'react' in namespace 'facebook'
58 | }
59 |
60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:57:44)

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
56 | {

57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
| ^ use of undeclared identifier 'JS'
58 | }
59 |
60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:57:81)

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
56 | {

57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
| ^ expected expression
58 | }
59 |
60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:57:83)

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
56 | {

57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
| ^ missing '[' at start of message send expression
58 | }
59 |
60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:57:101)

55 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)constantsToExport
56 | {

57 | return (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)[self getConstants];
| ^ expected ']'
58 | }
59 |
60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:62:20)

60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants
61 | {

62 | return facebook::react::typedConstantsJS::NativeSettingsManager::Constants({
| ^ no member named 'react' in namespace 'facebook'
63 | .settings = RCTJSONClean([_defaults dictionaryRepresentation])
64 | });
65 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:62:42)

60 | - (facebook::react::ModuleConstantsJS::NativeSettingsManager::Constants)getConstants
61 | {

62 | return facebook::react::typedConstantsJS::NativeSettingsManager::Constants({
| ^ use of undeclared identifier 'JS'
63 | .settings = RCTJSONClean([_defaults dictionaryRepresentation])
64 | });
65 | }

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:63:5)

61 | {
62 | return facebook::react::typedConstantsJS::NativeSettingsManager::Constants({

63 | .settings = RCTJSONClean([_defaults dictionaryRepresentation])
| ^ expected expression
64 | });
65 | }
66 |

❌ (node_modules/react-native/Libraries/Settings/RCTSettingsManager.mm:117:37)

115 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
116 | {

117 | return std::make_sharedfacebook::react::NativeSettingsManagerSpecJSI(params);
| ^ no member named 'react' in namespace 'facebook'
118 | }
119 |
120 | @EnD

› Compiling react-native Pods/React-RCTNetwork » RCTNetworking.mm

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:27:30)

25 | NSString *const RCTNetworkingPHUploadHackScheme = @"ph-upload";
26 |

27 | @interface RCTNetworking ()
| ^ cannot find protocol declaration for 'NativeNetworkingIOSSpec'
28 |
29 | - (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(NSDictionary<NSString *, id> *)data
30 | callback:(RCTHTTPQueryResult)callback;

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:687:32)

685 | #pragma mark - JS API
686 |

687 | RCT_EXPORT_METHOD(sendRequest:(JS::NativeNetworkingIOS::SpecSendRequestQuery &)query
| ^ use of undeclared identifier 'JS'
688 | callback:(RCTResponseSenderBlock)responseSender)
689 | {
690 | NSDictionary *queryDict = @{

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:734:30)

732 | }
733 |

734 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ no member named 'react' in namespace 'facebook'
735 | {
736 | return std::make_sharedfacebook::react::NativeNetworkingIOSSpecJSI(params);
737 | }

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:734:82)

732 | }
733 |

734 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
| ^ no member named 'react' in namespace 'facebook'
735 | {
736 | return std::make_sharedfacebook::react::NativeNetworkingIOSSpecJSI(params);
737 | }

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:691:22)

689 | {
690 | NSDictionary *queryDict = @{

691 | @"method": query.method(),
| ^ property 'method' not found on object of type '__strong id'
692 | @"url": query.url(),
693 | @"data": query.data(),
694 | @"headers": query.headers(),

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:692:19)

690 | NSDictionary *queryDict = @{
691 | @"method": query.method(),

692 | @"url": query.url(),
| ^ property 'url' not found on object of type '__strong id'
693 | @"data": query.data(),
694 | @"headers": query.headers(),
695 | @"responseType": query.responseType(),

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:693:20)

691 | @"method": query.method(),
692 | @"url": query.url(),

693 | @"data": query.data(),
| ^ property 'data' not found on object of type '__strong id'
694 | @"headers": query.headers(),
695 | @"responseType": query.responseType(),
696 | @"incrementalUpdates": @(query.incrementalUpdates()),

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:694:23)

692 | @"url": query.url(),
693 | @"data": query.data(),

694 | @"headers": query.headers(),
| ^ property 'headers' not found on object of type '__strong id'
695 | @"responseType": query.responseType(),
696 | @"incrementalUpdates": @(query.incrementalUpdates()),
697 | @"timeout": @(query.timeout()),

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:695:28)

693 | @"data": query.data(),
694 | @"headers": query.headers(),

695 | @"responseType": query.responseType(),
| ^ property 'responseType' not found on object of type '__strong id'
696 | @"incrementalUpdates": @(query.incrementalUpdates()),
697 | @"timeout": @(query.timeout()),
698 | @"withCredentials": @(query.withCredentials()),

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:696:36)

694 | @"headers": query.headers(),
695 | @"responseType": query.responseType(),

696 | @"incrementalUpdates": @(query.incrementalUpdates()),
| ^ property 'incrementalUpdates' not found on object of type '__strong id'
697 | @"timeout": @(query.timeout()),
698 | @"withCredentials": @(query.withCredentials()),
699 | };

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:697:25)

695 | @"responseType": query.responseType(),
696 | @"incrementalUpdates": @(query.incrementalUpdates()),

697 | @"timeout": @(query.timeout()),
| ^ property 'timeout' not found on object of type '__strong id'
698 | @"withCredentials": @(query.withCredentials()),
699 | };
700 |

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:698:33)

696 | @"incrementalUpdates": @(query.incrementalUpdates()),
697 | @"timeout": @(query.timeout()),

698 | @"withCredentials": @(query.withCredentials()),
| ^ property 'withCredentials' not found on object of type '__strong id'
699 | };
700 |
701 | // TODO: buildRequest returns a cancellation block, but there's currently

❌ (node_modules/react-native/Libraries/Network/RCTNetworking.mm:736:37)

734 | - (std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
735 | {

736 | return std::make_sharedfacebook::react::NativeNetworkingIOSSpecJSI(params);
| ^ no member named 'react' in namespace 'facebook'
737 | }
738 |
739 | @EnD

› Compiling react-native Pods/React-RCTNetwork » RCTNetworkPlugins.mm
› Compiling react-native Pods/React-RCTNetwork » RCTHTTPRequestHandler.mm

› 33 error(s), and 0 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

@alicantorun
Copy link

I have the same issue, any update on this?

@expelledboy
Copy link

expelledboy commented Feb 10, 2023

As I have only ever used Expo to develop native apps, I have not idea what this means, however I managed to get passed this particular error as follows:

$ find . -name FBReactNativeSpec.h                                                  
./apps/expo-app/ios/build/generated/ios/out/FBReactNativeSpec/FBReactNativeSpec.h
./apps/expo-app/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h

$ stat ./apps/expo-app/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h | grep Size
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file

$ stat ./apps/expo-app/ios/build/generated/ios/out/FBReactNativeSpec/FBReactNativeSpec.h | grep Size
  Size: 89394           Blocks: 176        IO Block: 4096   regular file

$ cp ./apps/expo-app/ios/build/generated/ios/out/FBReactNativeSpec/FBReactNativeSpec.h ./apps/expo-app/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h

$ npx expo run:ios

Notice how the header file was empty.

Continued: I have also notice the .podspec file alongside it was also empty, so I have just copied the entire contents of the directory and I now have a successful build!

cp ./apps/expo-app/ios/build/generated/ios/out/FBReactNativeSpec/* ./apps/expo-app/ios/build/generated/ios/FBReactNativeSpec/

@miallo
Copy link
Contributor

miallo commented Mar 2, 2023

Notice how the header file was empty.

Same here:

$ cat ./ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm ./ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h 
$

In our setup (without expo) we don't have the out directory and so unfortunately nothing to copy from...

Continued: I have also notice the .podspec file alongside it was also empty, so I have just copied the entire contents of the directory and I now have a successful build!

Interesting - you are not talking about ./ios/build/generated/ios/React-Codegen.podspec.json, but a podspec file in FBReactNativeSpec? That does not even exist for me 🤔 The two empty files from above are all I have in that folder...

@eexit
Copy link

eexit commented Mar 14, 2023

Hello,

I've been struggling my whole afternoon trying to run our app on iOS Simulator and it would not compile (same error message).

I can confirm that I was able to successfully compile with the cp command:

cp -R ios/build/generated/ios/out/FBReactNativeSpec/* ios/build/generated/ios/FBReactNativeSpec/
npx expo run:ios

Thanks!

@fredrik
Copy link

fredrik commented May 4, 2023

I was having the same issue as above (no member named 'react' in namespace 'facebook'), but using the proposed solution of copying the FBReactNativeSpec files resulted in another error (ld: 98 duplicate symbols for architecture arm64). Perhaps not too surprising as two identical copies were included as per ios/build/generated/ios/React-Codegen.podspec.json ("source_files": "**/*.{h,mm,cpp}"), although I do wonder why and how it worked for others in this thread. Oh well, nevermind that for now.

The solution that worked for me was to move the non-empty files like so:

mv -v ios/build/generated/ios/out/FBReactNativeSpec/* ios/build/generated/ios/FBReactNativeSpec/

Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 19, 2023
@expelledboy
Copy link

This is still an issue.

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants