facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.09k stars 24.31k forks source link

Multiple React-Codegen errors #34250

Open hpelitebook745G2 opened 2 years ago

hpelitebook745G2 commented 2 years ago

Description

I'm upgrade my RN project to 0.69.2 and got the following errors when compiling:

  1. 'react/renderer/components/rncore/ShadowNodes.h' file not found

       1. Did not find header 'renderer/components/rncore/ShadowNodes.h' in framework 'react' (loaded from '/Users/<user>/Library/Developer/Xcode/DerivedData/ProjectName-fnnixkbsrymrloacnykiaotbdtlb/Build/Products/Debug-iphonesimulator/React-Core')
  2. 'react/renderer/components/rncore/Props.h' file not found

       1. Did not find header 'renderer/components/rncore/Props.h' in framework 'react' (loaded from '/Users/<user>/Library/Developer/Xcode/DerivedData/ProjectName-fnnixkbsrymrloacnykiaotbdtlb/Build/Products/Debug-iphonesimulator/React-Core')
  3. 'react/renderer/components/rncore/EventEmitters.h' file not found

       1. Did not find header 'renderer/components/rncore/EventEmitters.h' in framework 'react' (loaded from '/Users/<user>/Library/Developer/Xcode/DerivedData/ProjectName-fnnixkbsrymrloacnykiaotbdtlb/Build/Products/Debug-iphonesimulator/React-Core')

Version

0.69.2

Output of npx react-native info

System:
  OS: macOS 12.4
  CPU: (8) arm64 Apple M1 Pro
  Memory: 204.66 MB / 16.00 GB
  Shell: 5.8.1 - /bin/zsh
Binaries:
  Node: 18.6.0 - /opt/homebrew/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 8.13.2 - /opt/homebrew/bin/npm
  Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
  CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.2 AI-212.5712.43.2112.8609683
  Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
  Java: 11.0.14.1 - /usr/bin/javac
npmPackages:
  @react-native-community/cli: Not Found
  react: 18.0.0 => 18.0.0 
  react-native: 0.69.2 => 0.69.2 
  react-native-macos: Not Found
npmGlobalPackages:
  *react-native*: Not Found

Steps to reproduce

Create a new RN project with 0.69.1 or 0.69.2 versions

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

Here's my Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
inhibit_all_warnings! #added to remove unneccesory pods warning
use_frameworks!

install! 'cocoapods',
:deterministic_uuids => false

target 'ProjectName' do

    use_modular_headers!

    config = use_native_modules!
    use_react_native!(:path => config[:reactNativePath], :hermes_enabled => true, :app_path => "#{Pod::Config.instance.installation_root}/..")

    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'GoogleSignIn'
    pod 'CountryPickerView'
    pod 'Alamofire', '~> 4.9.1'
    pod 'DeviceKit'
    pod 'PhoneNumberKit'
    pod 'OneSignal'
    pod 'MBProgressHUD'
    pod 'Firebase'
    pod 'Firebase/Performance'
    pod 'Firebase/Core'
    pod 'Firebase/Auth'
    pod 'Firebase/Database'
    pod 'Firebase/RemoteConfig'
    pod 'Firebase/Storage'
    pod 'Firebase/Crashlytics'
    pod 'Cosmos'
    pod 'Branch'
    pod 'Stripe'
    pod 'Contentful'
    pod 'lottie-ios'
    pod 'DateToolsSwift'
    pod 'GrowingTextView'
    pod 'ReachabilitySwift'
    pod 'Amplitude-iOS'
    pod 'RxSwift'
    pod 'RxCocoa'
    pod 'DKPhotoGallery'
    pod 'SDWebImage', '~> 5.10.4'
    pod 'ZendeskSupportSDK'
    pod 'GooglePlaces'
    pod 'UIScrollView-InfiniteScroll'
    pod 'UITextView+Placeholder'
    pod 'JWTDecode'
    pod 'AppsFlyerFramework'
    pod 'IQKeyboardManagerSwift'
    pod 'CropViewController'
    pod 'TwilioVideo'

    post_install do |installer|
      react_native_post_install(installer)
      __apply_Xcode_12_5_M1_post_install_workaround(installer)
    end
end

Here's my package.json:

{
  "name": "coreact",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "yarn react-native start",
    "android": "yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res  --minify",
    "run_android_debug": "react-native run-android --variant=debug",
    "run_android_release": "react-native run-android --variant=release",
    "ios": "react-native run-ios",
    "ios-bundle": "yarn react-native bundle --platform ios --entry-file index.js --bundle-output ./ios/assets/RCTBundle/ios.bundle --dev=false --platform='ios' --assets-dest='./ios' --minify",
    "test": "jest",
    "lint": "eslint .",
    "prettier-check": "npx prettier --check 'src/**/*.{ts,tsx,js,json,jsx}'",
    "prettier-format": "npx prettier --write 'src/**/*.{ts,tsx,js,json,jsx}'"
  },
  "dependencies": {
    "@react-navigation/native": "5.9.3",
    "@react-navigation/stack": "5.14.3",
    "@stripe/stripe-react-native": "0.14.0",
    "@types/react-native": "0.67.9",
    "joi": "17.4.2",
    "moment-timezone": "0.5.34",
    "patch-package": "6.4.7",
    "prop-types": "15.7.2",
    "react": "18.0.0",
    "react-native": "0.69.2",
    "react-native-autolink": "4.0.0",
    "react-native-exception-handler": "2.10.10",
    "react-native-gesture-handler": "2.4.2",
    "react-native-pod": "1.10.3",
    "react-native-reanimated": "1.13.3",
    "react-native-safe-area-context": "3.3.2",
    "react-native-safe-area-view": "1.1.1",
    "react-native-screens": "3.10.2",
    "react-native-swipe-gestures": "1.0.5",
    "resolve-url": "0.2.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "@babel/runtime": "7.12.5",
    "@react-native-community/eslint-config": "2.0.0",
    "babel-jest": "26.6.3",
    "babel-plugin-module-resolver": "4.1.0",
    "eslint": "7.32.0",
    "jest": "26.6.3",
    "metro-react-native-babel-preset": "0.70.3",
    "prettier": "2.7.0",
    "react-test-renderer": "18.0.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

The errors:

Screenshot 2022-07-23 at 3 45 29 AM
amanthegreatone commented 2 years ago

facing the same issue when upgrading from 0.68.2 to 0.69.4

cybexai commented 2 years ago

facing the same issue....no solutions yet ?

draggie commented 2 years ago

I have the same problem, upgrade to 0.70, works fine on intel MacBook, fails on M1

gus-t27 commented 2 years ago

Same issue for me as well, on M1 Macbook

jsonchou commented 2 years ago

fails on M1

CapDangTVF commented 2 years ago

fails on M1 - It took me a week and I can't fix it

vves commented 1 year ago

Failing on M1 as well.

adamsolomon1986 commented 1 year ago

+1 Same here

Bamorem commented 1 year ago

same here

include <react/renderer/components/rngesturehandler_codegen/ShadowNodes.h>

Error : 'react/renderer/components/rngesturehandler_codegen/ShadowNodes.h' file not found

allen-hsu commented 1 year ago

same here

Ggayane commented 1 year ago

anyone found a solution?

Bamorem commented 1 year ago

Hey so for me the solution was to remove the build folder (not clear build from Xcode but the folder itself), the node_modules folder, Pods folder, package-lock.json, Podfile.lock.

then reinstall everything by doing npm install && cd ./ios && pod install

FYI i got this error after trying to the command line. : RCT_NEW_ARCH_ENABLED=0 bundle exec pod install I don't know it it is related. but now i just tried to not use the new architecture

Ggayane commented 1 year ago

Hey so for me the solution was to remove the build folder (not clear build from Xcode but the folder itself), the node_modules folder, Pods folder, package-lock.json, Podfile.lock.

then reinstall everything by doing npm install && cd ./ios && pod install

FYI i got this error after trying to the command line. : RCT_NEW_ARCH_ENABLED=0 bundle exec pod install I don't know it it is related. but now i just tried to not use the new architecture

Thanks a lot this worked for me. I have also tried RCT_NEW_ARCH_ENABLED=0 bundle exec pod install, and I guess the reason was this as well.

asolomonbf commented 1 year ago

Hey so for me the solution was to remove the build folder (not clear build from Xcode but the folder itself), the node_modules folder, Pods folder, package-lock.json, Podfile.lock.

then reinstall everything by doing npm install && cd ./ios && pod install

FYI i got this error after trying to the command line. : RCT_NEW_ARCH_ENABLED=0 bundle exec pod install

I don't know it it is related. but now i just tried to not use the new architecture

This is not a solution. Of course it'd work if you disable the new architecture.

The error is about codegen issues with the new architecture.

Ggayane commented 1 year ago

Hey so for me the solution was to remove the build folder (not clear build from Xcode but the folder itself), the node_modules folder, Pods folder, package-lock.json, Podfile.lock. then reinstall everything by doing npm install && cd ./ios && pod install FYI i got this error after trying to the command line. : RCT_NEW_ARCH_ENABLED=0 bundle exec pod install I don't know it it is related. but now i just tried to not use the new architecture

This is not a solution. Of course it'd work if you disable the new architecture.

The error is about codegen issues with the new architecture.

For my case - I don't use new architecture.

aprilmintacpineda commented 1 year ago

Currently going through this error, been a few hours, really hard to fix when there's not much information about it

No solution above worked for me, mine looks like related to a library I'm using which I can't tell which one

my-project/react-native/ios/build/generated/ios/react/renderer/components/safeareacontext/ShadowNodes.cpp:11:10 'react/renderer/components/safeareacontext/ShadowNodes.h' file not found


/**
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * @generated by codegen project: GenerateShadowNodeCpp.js
 */

#include <react/renderer/components/safeareacontext/ShadowNodes.h>

namespace facebook {
namespace react {

extern const char RNCSafeAreaProviderComponentName[] = "RNCSafeAreaProvider";

} // namespace react
} // namespace facebook

image

EDIT 1:

I added ENV['RCT_NEW_ARCH_ENABLED'] = '0'; on the top of my Podfile and then did a rm -rf Pods Podfile.lock && pod install --repo-update and suddenly it works, which I find weird because I've done the equivalent in the terminal by running RCT_NEW_ARCH_ENABLED=0 pod install and it didn't work. Now I'm not sure about the repercussions of setting ENV['RCT_NEW_ARCH_ENABLED'] = '0'; but I didn't really intend to use the new arch at the moment because support is mostly experimental. Below is the dependencies on my package.json

"dependencies": {
  "@react-native-firebase/app": "^16.4.6",
  "@react-native-masked-view/masked-view": "^0.2.8",
  "@react-navigation/native": "^6.1.0",
  "@react-navigation/native-stack": "^6.9.5",
  "@react-navigation/stack": "^6.3.8",
  "date-fns": "^2.29.3",
  "expo": "^47.0.0",
  "expo-barcode-scanner": "~12.1.0",
  "expo-camera": "~13.1.0",
  "fluxible-js": "^6.1.5",
  "native-base": "^3.4.25",
  "react": "18.2.0",
  "react-fluxible": "^6.0.7",
  "react-native": "0.70.6",
  "react-native-config": "^1.4.11",
  "react-native-encrypted-storage": "^4.0.3",
  "react-native-gesture-handler": "^2.8.0",
  "react-native-permissions": "^3.6.1",
  "react-native-qrcode-svg": "^6.1.2",
  "react-native-safe-area-context": "^4.4.1",
  "react-native-screens": "^3.18.2",
  "react-native-sound-level-monitor": "^1.1.0",
  "react-native-svg": "^13.6.0",
  "react-native-uuid": "^2.0.1",
  "react-native-webrtc": "1.106.1"
},
"devDependencies": {
  "@babel/core": "^7.12.9",
  "@babel/runtime": "^7.12.5",
  "@react-native-community/eslint-config": "^3.2.0",
  "@tsconfig/react-native": "^2.0.2",
  "@types/jest": "^29.2.4",
  "@types/node": "^18.11.12",
  "@types/react": "^18.0.21",
  "@types/react-native": "^0.70.6",
  "@types/react-test-renderer": "^18.0.0",
  "@typescript-eslint/eslint-plugin": "^5.45.1",
  "@typescript-eslint/parser": "^5.45.1",
  "@typescript-eslint/typescript-estree": "^5.45.1",
  "babel-jest": "^29.3.1",
  "babel-plugin-module-resolver": "^4.1.0",
  "eslint": "8.29.0",
  "eslint-import-resolver-babel-module": "^5.3.1",
  "eslint-plugin-import": "^2.26.0",
  "eslint-plugin-jest": "^27.1.6",
  "eslint-plugin-module-resolver": "^1.5.0",
  "eslint-plugin-react": "^7.31.11",
  "eslint-plugin-react-hooks": "^4.6.0",
  "husky": "^8.0.2",
  "jest": "^29.3.1",
  "lint-staged": "^13.1.0",
  "metro-react-native-babel-preset": "0.73.4",
  "prettier": "^2.8.0",
  "react-test-renderer": "18.2.0",
  "typescript": "^4.8.3"
},
aubri61 commented 1 year ago

I also tried RCT_NEW_ARCH_ENABLED=1 npx pod-install ios and got this error.. when i'm installing 'react-native-image-picker'

I tried removing and re installing node modules, pods, podfiles and everything but still getting the same error. I also got xCode turn into red colored text.

스크린샷 2023-02-24 오후 12 29 32

I'm not sure it originally looks like but... anyway.

please solve this problem.. :(

latovicalmin commented 1 year ago

I faced same issue after running

RCT_NEW_ARCH_ENABLED=1 npx pod-install ios

so the solution for me was to run

RCT_NEW_ARCH_ENABLED=0 npx pod-install ios

and then this

dory2380 commented 1 year ago

Hey so for me the solution was to remove the build folder (not clear build from Xcode but the folder itself), the node_modules folder, Pods folder, package-lock.json, Podfile.lock.

then reinstall everything by doing npm install && cd ./ios && pod install

FYI i got this error after trying to the command line. : RCT_NEW_ARCH_ENABLED=0 bundle exec pod install I don't know it it is related. but now i just tried to not use the new architecture

I also go stuck here after running the following:

RCT_NEW_ARCH_ENABLED=1 npx pod-install ios

Solution: Just deleting the Pods and the /build folder and running pod install again did the trick. the node_modules and package.json can be left alone. They're not related.

github-actions[bot] commented 9 months ago

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.

Yuniac commented 9 months ago

Same issue still in 2024? anyone found a solution?

GHilario commented 7 months ago

Same issue here.

node_modules/react-native/ReactCommon/react/renderer/core/ComponentDescriptor.h:19:10 'react/renderer/graphics/Float.h' file not found

pritamparker commented 4 months ago

Xcode sucks. This issue is forever without any changes anywhere.