react-native-vector-icons: [Xcode 11] 'Multiple commands produce' error when building with new Xcode build system

Environment

MacOS 10.14.6 RN 0.60.5 Latest RNVI Building on iOS

Description

Describe your issue in detail. Include screenshots if needed.

Reproducible Demo

https://github.com/facebook/react-native/issues/20492#issuecomment-533912772

On Xcode before upgrade 11, things work correctly and font assets copy without fatal error.

After Xcode 11 stable released and upgraded, it required fonts removal under [CP] Copy Pods Resources in Build Phases. Subsequent pod update brings them back, needing manual removal again.

Not sure if this is fixable only with special treatment on Xcode >= 11?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 110
  • Comments: 89

Commits related to this issue

Most upvoted comments

Removing duplicate font files in Copy Bundle Resources worked for me.

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.

Find a solution, simply remove duplicate reference fonts in “Copy Bundle Resources” NOT in “[CP] Copy Pods Resources”

For anyone else who didn’t know this, Copy Bundle Resources can be found under the Build Phases` tab in the target in your project

For anyone else who didn’t know this, Copy Bundle Resources can be found under the Build Phases` tab in the target in your project

Thanks. Everyone providing a solution but no one saying where it is 👍

Same here.

It looks like a bug or some new issue with new Xcode version.

Error response is:

Failed to build iOS project. We ran “xcodebuild” command but it exited with error code 65.

Detailed response:

Build system information error: Multiple commands produce ‘/path/of/the/project/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/Zocial.ttf’:

1) Target ‘NameOfTheProject’ (project ‘NameOfTheProject’) has copy command from ‘/path/of/the/project/NameOfTheProject/node_modules/react-native-vector-icons/Fonts/Zocial.ttf’ to ‘/path/of/the/project/NameOfTheProject/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/Zocial.ttf’

2) That command depends on command in Target ‘NameOfTheProject’ (project ‘NameOfTheProject’): script phase “[CP] Copy Pods Resources”

Build system information error: Multiple commands produce ‘/path/of/the/project/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/SimpleLineIcons.ttf’:

1) Target ‘NameOfTheProject’ (project ‘NameOfTheProject’) has copy command from ‘/path/of/the/project/NameOfTheProject/node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf’ to ‘/path/of/the/project/NameOfTheProject/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/SimpleLineIcons.ttf’

2) That command depends on command in Target ‘NameOfTheProject’ (project ‘NameOfTheProject’): script phase “[CP] Copy Pods Resources”

That response repeat for each .ttf file used by the library.

I had to temporary react-native unlink react-native-vector-icons, and the project build again, but with not icons.

for me, the safest and easiest way was:

npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that’s it!

Tested on the following versions of packages:

  • react-native: 0.62.2;
  • react-native-vector-icons: 6.6.0;

I’ve made this steps and project are building again:

  1. Add react-native-vector-icons:
$ yarn add react-native-vector-icons 
  1. Link resources to project:
cd <your-project>; react-native link; cd <your-project>/ios; pod install;
  1. Open project in the Xcode and click in the left side on your project name: Screen Shot 2020-04-09 at 15 16 56

  2. Go to the Build Phases like the following: Screen Shot 2020-04-09 at 15 17 03

  3. You’ll see the Copy Bundle Resources like the following: Screen Shot 2020-04-09 at 15 17 18

Note: Remove all font icons from the list, in the case of image icons was been removed.

  1. Run your project again to re-install with this update:
$ react-native run-ios

I hope this step by step helps you. ✨

Fixed it by removing fonts in the Copy Bundle Resource

@ulises-jimenez the real mvp

Very simple solution … after pod install , run npx react-native unlink react-native-vector-icon

then paste the following in info.plist

	<key>UIAppFonts</key>
	<array>
		<string>AntDesign.ttf</string>
		<string>Entypo.ttf</string>
		<string>EvilIcons.ttf</string>
		<string>Feather.ttf</string>
		<string>FontAwesome.ttf</string>
		<string>FontAwesome5_Brands.ttf</string>
		<string>FontAwesome5_Regular.ttf</string>
		<string>FontAwesome5_Solid.ttf</string>
		<string>Fontisto.ttf</string>
		<string>Foundation.ttf</string>
		<string>Ionicons.ttf</string>
		<string>MaterialCommunityIcons.ttf</string>
		<string>MaterialIcons.ttf</string>
		<string>Octicons.ttf</string>
		<string>SimpleLineIcons.ttf</string>
		<string>Zocial.ttf</string>
	</array>

@kindacoder see if same fonts exist, because if you install two packages that have fonts there’s a chance there will be duplicates. I had installed react-native-vector-icons and native-base, both had fonts and there were duplicates in the bundle resources and that was causing this error. Here’s where I found the solution

thank you so much @KandarpAjvalia

if I remove the fonts from the Copy Bundle Source file the build succeed but it gives me another error unrecognised Font family 'MarlinGeo-Black'. There are my Error.

<img width="1280" alt="Screenshot 2021-07-01 at 10 40 00 AM" src="https://user-images.githubusercontent.com/78194973/124072516-45545a80-da5a-11eb-85b2-24002b9714c1.png">

Multiple commands produce '/Users/umairhassan/Library/Developer/Xcode/DerivedData/truecaller-altzuyoazoqmqdeceflrhwqheodc/Build/Products/Debug-iphonesimulator/truecaller.app/L-Bold.ttf':
1) Target 'truecaller' (project 'truecaller') has copy command from '/Users/umairhassan/repos/CallerApp/src/assets/fonts/L-Bold.ttf' to '/Users/umairhassan/Library/Developer/Xcode/DerivedData/truecaller-altzuyoazoqmqdeceflrhwqheodc/Build/Products/Debug-iphonesimulator/truecaller.app/L-Bold.ttf'
2) That command depends on command in Target 'truecaller' (project 'truecaller'): script phase “[CP] Copy Pods Resources”

Here I have my ScreenShots .

Simulator Screen Shot - iPhone 12 Pro Max - 2021-07-01 at 10 37 50 Screenshot 2021-07-01 at 10 40 00 AM

if I remove these from here then the error show in the first screenshot I got. and if I add there lines then the second one.

can anyone explain this.

Tested on the following versions of packages:

  • react-native: 0.62.2;
  • react-native-vector-icons: 6.6.0;

I’ve made this steps and project are building again:

  1. Add react-native-vector-icons:
$ yarn add react-native-vector-icons 
  1. Link resources to project:
cd <your-project>; react-native link; cd <your-project>/ios; pod install;
  1. Open project in the Xcode and click in the left side on your project name:
Screen Shot 2020-04-09 at 15 16 56
  1. Go to the Build Phases like the following:
Screen Shot 2020-04-09 at 15 17 03
  1. You’ll see the Copy Bundle Resources like the following:
Screen Shot 2020-04-09 at 15 17 18

Note: Remove all font icons from the list, in the case of image icons was been removed.

  1. Run your project again to re-install with this update:
$ react-native run-ios

I hope this step by step helps you. ✨

Solved problem, thank so much.

File -> Workspace Settings -> Legacy Build System

add this to your podfile

  post_install do |installer|
    system("sed -i '' '/s.resources/d' ../node_modules/react-native-vector-icons/RNVectorIcons.podspec")
  end

Only remove fonts from build phases that are part of RNVI, if you are adding your own fonts you will need these under Copy Bundle Resource.

Removing duplicate font files in Copy Bundle Resources worked for me.

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.

Hi jackli, I tried it but it created a new problem 😦

Screen Shot 2019-09-24 at 16 55 34 Screen Shot 2019-09-24 at 16 55 43 Screen Shot 2019-09-24 at 16 55 54 Screen Shot 2019-09-24 at 16 56 30

same here with 0.61.0-rc.3 and xcode 11 11A420a mojave 10.14.6

@RnbWd Incase you haven’t found your workaround yet, my approach to avoid having to remove it after every pod install was the following:

  1. yarn add react-native-vector icons
  2. Go into node_modules/react-native-vector-icons/Fonts and copy the fonts you wish to use.
  3. Place the copied fonts in a folder (in my case src/assets/icons)
  4. Include the icons folder in your react-native-config.js
module.exports = {
  assets: ['./src/assets/icons']
};
  1. Modify node_modules/react-native-vector-icons/react-native-config.js to the following
module.exports = {
  dependency: {
    assets: [],
  },
};
  1. Inside node_modules/react-native-vector-icons/RNVectorIcons.podspec, remove the s.resources = "Fonts/*.ttf" line entirely.
require 'json'
version = JSON.parse(File.read('package.json'))["version"]

Pod::Spec.new do |s|

  s.name           = "RNVectorIcons"
  s.version        = version
  s.summary        = "Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling."
  s.homepage       = "https://github.com/oblador/react-native-vector-icons"
  s.license        = "MIT"
  s.author         = { "Joel Arvidsson" => "joel@oblador.se" }
  s.platforms      = { :ios => "9.0", :tvos => "9.0" }
  s.source         = { :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v#{s.version}" }
  s.source_files   = 'RNVectorIconsManager/**/*.{h,m}'
  s.preserve_paths = "**/*.js"
  s.dependency 'React'

end
  1. Run npx patch-package react-native-vector-icons.
  2. Run cd ios && pod install && cd ..
  3. Run npx react-native link
  4. Add "postinstall": "npx patch-package" to the scripts in package.json so the patch is automatically applied after every install.

@kindacoder see if same fonts exist, because if you install two packages that have fonts there’s a chance there will be duplicates. I had installed react-native-vector-icons and native-base, both had fonts and there were duplicates in the bundle resources and that was causing this error. Here’s where I found the solution

saved the day

It’d be nice not to have to manually remove this every time I run pod install. Screen Shot 2020-02-05 at 11 39 20 AM

Following this video finally got my fonts to show up. I was getting red question mark for a few hours and duplicate error message. Hope this helps someone out.
https://www.youtube.com/watch?v=5Rc0ujISKUo

you can fix it by running next command if you’re using react-native@0.60.0 or above

npx react-native unlink react-native-vector-icons

for me, the safest and easiest way was:

npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that’s it!

It work perfectly!

@kindacoder see if same fonts exist, because if you install two packages that have fonts there’s a chance there will be duplicates. I had installed react-native-vector-icons and native-base, both had fonts and there were duplicates in the bundle resources and that was causing this error. Here’s where I found the solution

Whyyyyyyyyyy is this still a thing 😦((((((((((((((((

@fungilation, i am pretty sure that this issue is very much still alive. let me know if i am missing something. i just wasted almost 90 minutes trying to figure out why this was happening in my app after upgrading some tooling. it would be unfortunately if this kept happening to more folks.

it seems like the crux of the problem is that the font files are being referred to by both the react-native.config.js and the podspec.

the reference to the font files as assets in the react-native.config.js will cause the react-native link to load the fonts as a resource for the App project.

while the reference to the font files as resources in the RNVectorIcons.podspec will cause pod install to load the fonts as resources for the Podfile project.

i suspect that the solution is to update either react-native.config.js or podspec to that the fonts are not double counted.

Real problem with module.

Fixed it by removing fonts in the Xcode - Build Phases/[CP] Copy Bundle Resource

@awgeorge We’re in the same situation, what worked for us was to just choose the legacy build system in xcode 11.1.

Is there anyway to disable this feature? We’re still on .59 and the linking happens in our build process. We don’t have our workspace committed, the pipeline literally does a pod install and react native link every time. Now our builds fail as its duplicating these fonts.

removing icon files from Copy Bundle Resources worked for me

oh my god! Why this bug still exist ? 2021 is coming soon. This shit bug waste three hours of my time.

To build on @carlost strategy, for me it was the podspec. Adding this to the scripts section on package.json fixed it for me.

"postinstall": "sed -i '' '/s.resources/d' ./node_modules/react-native-vector-icons/RNVectorIcons.podspec"

Would be nice if the following was in the README.md telling users to remove the font files rather than adding them if they are using autolinking (the default on the latest react native).

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

I didn’t have to remove the icon files manually. The easiest solution is to create a file in the root of the project: react-native.config.js, and add the following content;

module.exports = {
  dependencies: {
    'react-native-vector-icons': {
      platforms: {
        ios: null,
      },
    },
  },
};

You might have to rerun yarn install and also install pods again.

UPDATE: Not sure what fixed it but it works now

Nothing working for me. Anyone have any ideas? All the fonts added in my Info.plist with no duplicates: image. Removing them from the Copy Bundle Resources solves the multiple commands produce error but that gives me and Unrecognized font family error: image

I also tried @goff-studio’s workaround of unlinking, uninstalling and reinstalling the package and @mpeguese’s video (creating a Fonts folder in the project folder) with the same results as above,

My app builds fine but its the deploys using Fastlane that are having issues

Remove all .ttf files that belongs to react-native-vector-icons from Copy Bundle Resources under the Build Phases in Xcode works for me.

For us, we had font entries in Copy bundle resources as well as copy pods resource. Fonts were also in the info.list file. Removing from pods resources worked for us.

pod install

npx react-native run-ios

so to follow up on my earlier post … i have a post install hook in my package.json that patches the react-native.config.js file in react-native-vector-icons to remove the assets: ['Fonts'] config. that resolves this issue.

Be sure to have unchecked the “Target Membership”

Is there any way to avoid having manually go into XCode and remove the fonts from the Copy Bundle Resource tap when launching a new project using react-native-vector-icons and custom fonts with RN 0.6+ (autolink feature)?

you all were on xcode while i was looking on vscode xD

for me, the safest and easiest way was: npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios that’s it!

which method did you use for the ios installation (https://github.com/oblador/react-native-vector-icons#ios) … the cocoa pods one? I’m still getting a Unrecognized font family Material Design Icons error when running npx react-native run-ios command

React Native Link [that I’m working on 0.64 version, so basically, Linked automatically after installation.

Hi! I’m wondering why this issue is closed. It is certainly not resolved, since autolinking when you do pod install with react-native-vector-icons still breaks at least iOS release builds. This still happens with the newest versions of React Native and this package.

"react-native": "0.63.3",
"react-native-vector-icons": "^7.0.0",

Find a solution, simply remove duplicate reference fonts in “Copy Bundle Resources” NOT in “[CP] Copy Pods Resources”

Thank you! I lost a day trying to add these icons D: