34

We were working on a react native project. One of my team members added some native modules on Linux and linked android. By then I am trying to link things in iOS but the build is always failing with this kind of error trace. The Android project is building normally.

I deleted xyz.xcworkspace and Podfile.lock then tried pod install.
Also, I tried to delete my node_modules and then yarn install followed by yarn link.

react-native-cli: 2.0.1  
react-native: 0.61.4  
yarn 1.19.1
Pod 1.8.4
XCode Version 11.2.1 (11B500)
macOS Catalina 10.15.1 (19B88)

xyz warning

duplicate output file '/Users/user/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Products/Debug-iphonesimulator/xyz.app/AntDesign.ttf' on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/faisal/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Intermediates.noindex/xyz.build/Debug-iphonesimulator/xyz.build/Script-47F818C57EEC47EA3303EA1B.sh

xyz workspace errors

Multiple commands produce '/Users/user/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Products/Debug-iphonesimulator/xyz.app/Zocial.ttf':
1) Target 'xyz' (project 'xyz') has copy command from '/Users/user/Desktop/xyz/native/node_modules/react-native-vector-icons/Fonts/Zocial.ttf' to '/Users/user/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Products/Debug-iphonesimulator/xyz.app/Zocial.ttf'
2) That command depends on command in Target 'xyz' (project 'xyz'): script phase “[CP] Copy Pods Resources”

There are multiple errors and warnings like this but have same format with different file names.

7 Answers 7

66

The problem is you have duplicate resources due to RN auto-linking. To fix this

  1. Click Your Xcode project Name on project files
  2. Navigate to Build Phases tab
  3. Scroll down to Copy Bundle Resources drop down to expand
  4. Scroll down to Copy Pod Resources and compare the duplicates with the ones on Copy Bundle Resources
  5. Delete the duplicates on Copy Bundle Resources not on Copy Pod Resources
  6. Rebuild your project. Also refer to this issue
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks man this did it for me! Went post surfing to finally find what I was looking for
I had a problem with Ionicons fonts causing a build fail. This fixed it for me though! Thank you so much :)
I deleted "Images.xcassets" from Copy Bundle Resources and it got it working for me, although "Images.xcassets" was not in Copy Pod Resources.
i removed all .ttf files from copy Bundle Resources to solve the issue
still great working solution ty
30

The problem seems to be caused by the new autolinking feature in React Native 0.60 - the line use_native_modules! in ios/Podfile means when you do pod install, any pods found in node_modules are automatically linked. This means that links to all font files are added to [CP] Copy Pods Resources when you do pod install.

Please see this image.

  1. Open Your iOS project in Xcode.

  2. Then follow these steps in the image.

    enter image description here

  1. You will see input Files and output files under Copy Pod Resource. Remove the duplicate ones listed here from the above list in Copy Bundle Resources.

  2. Run react-native run-ios

6 Comments

Im glad This helps :)
I can't believe such a good answer receives only one upvote
In my case, working with react-native whe solution was to remove all this .ttf files.
This worked for me after following steps to add .ttf files with react-native-vector-icons. The fonts weren't being recognized through auto-linking, so I had to manually add them. Removing them from the Copy Bundle Resources section fixed the issue.
@JuanAntonio but only in Copy Bundle Resources
|
11

For the xCode 11+ and react-native 0.60+,

The answer is copied from this GitHub issue answer

The problem seems to be caused by the new autolinking feature in React Native 0.60 - the line use_native_modules! in ios/Podfile means when you do pod install, any pods found in node_modules are automatically linked. This means that links to all font files are added to [CP] Copy Pods Resources when you do pod install.

If you previously installed react-native-vector-icons manually by adding the font files to Copy Bundle Resources, you then get a "Multiple commands produce..." fatal build error.

So to fix the problem, just remove the font files from Copy Bundle Resources, so that they are only in [CP] Copy Pods Resources.

So the official documentation on the repository of the library is outdated and does not mention it. You should follow installation steps up to adding the fonts list to info.plist, and DO NOT create Fonts folder-group and copy-paste the fonts into that folder.

1 Comment

This answer gives the correct picture about this issue. thanks!
6

You need to delete this manually from Copy Bundle resource.

Else You need to change build setting to build using legacy build.

You will find the Copy Bundle resource under build phases.

enter image description here

1 Comment

Where will I found Copy Bundle resource? or what settings to change.
0

What fixed it for me was removing multiple entries of [CP] Embed Pods Frameworks / and / [CP] Copy Pods Resources */, within a single buildPhases block in the project.pbxproj file. These got added while upgrading RN version to 0.68.7.

For instance:

buildPhases = (
            ...
            00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
            E235C05ADACE081382539298 /* [CP] Embed Pods Frameworks */, <== newly added
            ...
    );

Removing the older entry (00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks*/, in this case) and also the corresponding block of code from /* Begin PBXShellScriptBuildPhase section */

00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
            isa = PBXShellScriptBuildPhase;
            buildActionMask = 12;
            files = (
            );
            inputFileListPaths = (
                ...
            );
            name = "[CP] Embed Pods Frameworks";
            outputFileListPaths = (
                ...
            );
            ...
        };

made the error go away.

Comments

0

What i done is

  • step 1: reverted back to working code

  • step 2: deleted all the react-native-fonts fonts files from assets/fonts

  • step 3: npx react-native-asset

  • step 4: cd ios

  • step 5 : pod install

  • step 6 : open xcode and run the simulator

Note I am not using rn-fonts many places I mostly use svg files

Everything worked fine for me try it

Comments

-2

I am able to solve the issue by following this step. All you have to do is open your project folder -> go to /ios and open file YourProjectName.xcodeproj then follow this https://lifesaver.codes/answer/error-multiple-commands-produce-in-xcode-10, then you just need to delete all fonts there and run npx react-native run-ios

1 Comment

link not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.