bamlab / react-native-image-resizer

🗻 Resize local images with React Native
MIT License
1.61k stars 349 forks source link

'ReactCommon/RCTTurboModule.h' file not found #410

Open ShaoGongBra opened 2 months ago

ShaoGongBra commented 2 months ago

RN0.75 opens a new architecture and packages IOS, resulting in this error

serhii-yalla commented 2 months ago

the same issue

MateoParodi commented 2 months ago

+1

khushal87 commented 2 months ago

+1

veerabharathkumar commented 2 months ago

+1

ashwini-ksingh commented 1 month ago

Facing the same issue.

sandipsarkar13 commented 1 month ago

+1

ashwini-ksingh commented 1 month ago

Adding install_modules_dependencies(s) solved the issue for me.

Patch File:

diff --git a/package.json b/package.json
index 7a73b6e0d42d5eacd9d9d15017d019ed67a09a0a..408f7d6b3d79036518b4da904daa706eef15b241 100644
--- a/package.json
+++ b/package.json
@@ -169,12 +169,8 @@
     ]
   },
   "codegenConfig": {
-    "libraries": [
-      {
-        "name": "RNImageResizerSpec",
-        "type": "modules",
-        "jsSrcsDir": "src"
-      }
-    ]
+     "name": "RNImageResizerSpec",
+     "type": "modules",
+     "jsSrcsDir": "src"
   }
 }
diff --git a/react-native-image-resizer.podspec b/react-native-image-resizer.podspec
index c7ba7d9e261abbb890cccf0c9dd58eba118083be..749803239f7765994408d525e3cf7cff787e847a 100644
--- a/react-native-image-resizer.podspec
+++ b/react-native-image-resizer.podspec
@@ -32,6 +32,7 @@ Pod::Spec.new do |s|
     s.dependency "RCTRequired"
     s.dependency "RCTTypeSafety"
     s.dependency "ReactCommon/turbomodule/core"
+    install_modules_dependencies(s)
   end
 end

Note: package.json changes are related to warning shown while building (#413)

nickvgn commented 1 month ago

+1

ravindraguptacapgemini commented 1 month ago

+1

kdn0325 commented 1 month ago

+1

khushal87 commented 1 month ago

This is reproducible easily when enabling the new arch on RN 0.75.4

khushal87 commented 1 month ago

@taboulot can you give it a look?

Jin-seop commented 1 month ago

+1

kdn0325 commented 4 weeks ago

I updated to react native 0.76.0 version and got this issue when using it 😢

yuriiburov commented 3 weeks ago

+1 after enabling the new arch

Stas-Buzunko commented 3 weeks ago

the same issue using 0.76.1

joseviniciusnunes commented 3 weeks ago

+1

macksal commented 2 weeks ago

Same problem on react-native 0.76.1, expo 52.

Testing the workaround mentioned above seems to have fixed the build error, but I haven't launched the application to fully verify it. (I am still getting build errors from an unrelated dependency).

zhiqingchen commented 2 weeks ago

https://github.com/bamlab/react-native-image-resizer/issues/410#issuecomment-2391113068

works for me

edritech93 commented 2 weeks ago

same issue "react-native": "0.76.1", "@bam.tech/react-native-image-resizer": "^3.0.10",

prasanna-colan commented 2 weeks ago

Faced the same issue in "react-native": "0.76.1"

Solved by Adding install_modules_dependencies(s) below the line s.dependency "ReactCommon/turbomodule/core" in node_modules/@bam.tech/react-native-image-resizer/react-native-image-resizer.podspec

OR

Without installing the patch, using post install, inside script, "postinstall": "node ./scripts/fixPodspec.js" in package.json

Create a file: scripts/fixPodspec.js

const fs = require('fs');
const path = require('path');

const podspecPath = path.resolve('node_modules/@bam.tech/react-native-image-resizer/react-native-image-resizer.podspec');

fs.readFile(podspecPath, 'utf8', (err, data) => {
  if (err) {
    console.error('Error reading podspec file:', err);
    return;
  }

  // Check if the modification is already done, to avoid redundant edits
  if (!data.includes('install_modules_dependencies(s)')) {
    const modifiedData = data.replace(
      's.dependency "ReactCommon/turbomodule/core"',
      's.dependency "ReactCommon/turbomodule/core"\n  install_modules_dependencies(s)'
    );

    fs.writeFile(podspecPath, modifiedData, 'utf8', (err) => {
      if (err) {
        console.error('Error writing podspec file:', err);
      } else {
        console.log('Podspec file updated successfully.');
      }
    });
  }
});

Then run npm i

It works to me

gh-pro commented 1 week ago

it's work for me

Adding install_modules_dependencies(s) solved the issue for me.

Patch File:

diff --git a/package.json b/package.json
index 7a73b6e0d42d5eacd9d9d15017d019ed67a09a0a..408f7d6b3d79036518b4da904daa706eef15b241 100644
--- a/package.json
+++ b/package.json
@@ -169,12 +169,8 @@
     ]
   },
   "codegenConfig": {
-    "libraries": [
-      {
-        "name": "RNImageResizerSpec",
-        "type": "modules",
-        "jsSrcsDir": "src"
-      }
-    ]
+     "name": "RNImageResizerSpec",
+     "type": "modules",
+     "jsSrcsDir": "src"
   }
 }
diff --git a/react-native-image-resizer.podspec b/react-native-image-resizer.podspec
index c7ba7d9e261abbb890cccf0c9dd58eba118083be..749803239f7765994408d525e3cf7cff787e847a 100644
--- a/react-native-image-resizer.podspec
+++ b/react-native-image-resizer.podspec
@@ -32,6 +32,7 @@ Pod::Spec.new do |s|
     s.dependency "RCTRequired"
     s.dependency "RCTTypeSafety"
     s.dependency "ReactCommon/turbomodule/core"
+    install_modules_dependencies(s)
   end
 end

Note: package.json changes are related to warning shown while building (#413)

Hy, thanks you. It's work for me.

Etape to fix this

Go to node_modules/@bam.tech/react-native-image-resizer/react-native-image-resizer.podspec

adding this install_modules_dependencies(s) after s.dependency "ReactCommon/turbomodule/core"

open package.json on same directory and replace content of "codegenConfig": { "libraries": [ { "name": "RNImageResizerSpec", "type": "modules", "jsSrcsDir": "src" } ] }

by this "codegenConfig": { "name": "RNImageResizerSpec", "type": "modules", "jsSrcsDir": "src" }

on terminal => yarn install or npm install and cd ios => exec bundle exec pod install on xcode, clean build and its work