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

[Xcode 11] 'Multiple commands produce' error when building with new Xcode build system #1074

Closed
2 tasks done
fungilation opened this issue Sep 23, 2019 · 89 comments
Closed
2 tasks done

Comments

@fungilation
Copy link

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

facebook/react-native#20492 (comment)

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?

@efstathiosntonas
Copy link

efstathiosntonas commented Sep 23, 2019

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

@chescko29
Copy link

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.

@bpouzet
Copy link

bpouzet commented Sep 23, 2019

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

@jacklj
Copy link

jacklj commented Sep 23, 2019

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.

@KaneNguyen
Copy link

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

@KaneNguyen
Copy link

@jacklj can you help me, pls !

@awgeorge
Copy link

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.

@keisnet
Copy link

keisnet commented Oct 16, 2019

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

@webdesign2be
Copy link

I had the same issue with the double linking stuff on Xcode.

"react-native": "0.61.5"
"react-native-vector-icons": "^6.6.0"

Xcode: 11.2.1

I used this solution to get it to work for me: #661 (comment)

But on the console i get this:

error: React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above.
Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically.
If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

error: Could not find the following native modules: RNVectorIcons. Did you forget to run "pod install" ?

As long as I don't install the pod RNVectorIcons all works as expected.
But that can't be more than a temporary workaround.

@ulises-jimenez
Copy link

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

@sadikyalcin
Copy link

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 👍

@pacozaa
Copy link

pacozaa commented Dec 17, 2019

@ulises-jimenez the real mvp

natalie-hunt pushed a commit to natalie-hunt/baesic that referenced this issue Dec 20, 2019
- one error was caused by react-native-vector-icons interacting poorly with the new autolinking feature. details: oblador/react-native-vector-icons#1074 (comment)

- one was caused by renaming colors.js and textStyles.js to Colors and TextStyles earlier. Updates cases for these files.
@ManigandanRaamanathan
Copy link

Fixed it by removing fonts in the Copy Bundle Resource

@leonardomarciano
Copy link

Real problem with module.

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

@njdullea
Copy link

njdullea commented Jan 7, 2020

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.

@jonasgroendahl
Copy link

jonasgroendahl commented Jan 10, 2020

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)?

@marktdodds
Copy link

@jonasgroendahl This fixed it for me #1074 (comment)

@jonasgroendahl
Copy link

@marktdodds thanks, this worked! :)

@lore978
Copy link

lore978 commented Feb 4, 2020

Be sure to have unchecked the “Target Membership”

@RnbWd
Copy link

RnbWd commented Feb 5, 2020

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

@MattiasMansson
Copy link

@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.

@carlost
Copy link

carlost commented Mar 5, 2020

@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.

@carlost
Copy link

carlost commented Mar 9, 2020

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.

@orinoco
Copy link

orinoco commented Mar 19, 2020

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"

@29er
Copy link

29er commented Mar 28, 2020

@orinoco none should have to do that. Ever.

@lsbyerley
Copy link

lsbyerley commented Aug 8, 2021

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

@goff-studio
Copy link

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.

@alitele
Copy link

alitele commented Aug 11, 2021

For those want to know the reason behind it.

When React has already auto linked vector icons and you do manual link there comes duplicate resources.
Cheers.

@nabilfreeman
Copy link

Whyyyyyyyyyy is this still a thing :(((((((((((((((((

@christophermaloney
Copy link

I had to uncheck "For Install builds only" on [CP] Copy Pods Resources for it to work for me.
I also manually added the font names into the "Fonts provided by application" section in the info.plist and removed the font files from Copy Bundle Resources but not sure if that was required.

Hopefully this helps someone.

@acro5piano
Copy link

  1. Follow the official instruction
  2. Remove all font files from "Copy Bundle Resources" as described in this thread

My fault was not editing my "info.plist"

@thangpq
Copy link

thangpq commented Aug 16, 2021

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.

You save my life :(
Many thanks

@thangpq
Copy link

thangpq commented Aug 16, 2021

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

perfect !

@tti-prasad
Copy link

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

Thank you. You saved my day Man!!

@ssathishppm
Copy link

ssathishppm commented Aug 24, 2021

Any option to remove those files from copy bundle resources dynamically (using command line) OR how to avoid adding those files

@vjcspy
Copy link

vjcspy commented Aug 31, 2021

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!

@Danirill
Copy link

Danirill commented Oct 6, 2021

Does anyone know how to fix this problem with AppCenter?

@mpeguese
Copy link

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

@souradeepmajumdar05
Copy link

Find a solution, simply remove duplicate reference fonts in "Copy Bundle Resources" NOT in "[CP] Copy Pods Resources"
remove all ocurrence of the duplicate tff files

kamalkishor1991 added a commit to croma-app/huehive-mobile-app that referenced this issue Nov 20, 2021
bhujoshi pushed a commit to croma-app/huehive-mobile-app that referenced this issue Jan 10, 2022
* replace code with new npx react-native init command

* rename package name

* add @react-navigation/native as a dependency
* By following https://reactnavigation.org/docs/getting-started/ for version 6.x

* about us page in home screen

* basic working home screen after fixing multiple issues

* basic working screens on ios and android

* use react-native-vector-icons

* run on ios with icons

* basic working side menu

* Google Java Format

* fix palette initilization for ios
* Fix duplicate icons issue on ios build
oblador/react-native-vector-icons#1074 (comment)

* basic header and add all the existing screens

* fix side menu on ios

* fix labels, icons etc

* Google Java Format

* hamburger menu icon

* fix about us screen and improved side menu

* copy android code from old version to this version

* fix android bridge issues

* Google Java Format

* use fastlane to build ios app
* Basic test flight is working and failing with few errors from app store
* Links
https://semaphoreci.com/blog/apps-built-with-react-native-ios
https://thecodingmachine.github.io/react-native-boilerplate/docs/BetaBuild/
https://docs.fastlane.tools/codesigning/getting-started/

* fix NSPhotoLibraryUsageDescription warning from apple

* refactoring and improvements

* color picker from image using color thief

Co-authored-by: github-actions <>
@saravanakumargn
Copy link

Screenshot 2022-01-11 at 7 29 19 PM

@Jcs1994
Copy link

Jcs1994 commented Feb 9, 2022

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

@KrisLau
Copy link

KrisLau commented Jun 8, 2022

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

@saad277
Copy link

saad277 commented Mar 25, 2023

Worked for me : facebook/react-native#29709 (comment)

@Shaxadhere
Copy link

removing icon files from Copy Bundle Resources worked for me

@rrsalian16
Copy link

removing icon files from Copy Bundle Resources worked for me

this worked for me

@anietieasuquo
Copy link

anietieasuquo commented Aug 8, 2023

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.

@elibroftw
Copy link

elibroftw commented Aug 19, 2023

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.

@Dat-Mobile
Copy link

For me, I deleted Fonts folder inside project and it works

I listed the fonts in Info.plist

@dazld
Copy link

dazld commented Jan 3, 2024

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.

It's 2024, and this is the best answer here. Thanks for sharing!

@atultiwaree
Copy link

By Mistake I've deleted copy bundle resources now after build I'm getting black screen how do I fix this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests