Skip to content

Instantly share code, notes, and snippets.

@angelod1as
Last active June 26, 2020 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelod1as/7279f3b32843105a9e52bc9a3d25cea7 to your computer and use it in GitHub Desktop.
Save angelod1as/7279f3b32843105a9e52bc9a3d25cea7 to your computer and use it in GitHub Desktop.
How to solve idiot React-Native Link error in IOs

So, after pod install in my ios folder and yarn ios, I got all these errors saying stuff was duplicated.

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

I have no knowledge of how XCode works, so I went with the good and old try-and-error to make things good.

Below, the solution:

SOLUTION

You WILL need a new React Native project. There's no way (until now) to fix this on old ones.

Remove /* [CP] Copy Pods Resources */ whole section.

This might break other stuff, but for me it worked, as the project was duplicating fonts and they don't actually break the app.

Actual code I deleted:

		2FD7D2151684C90D15D228FF /* [CP] Copy Pods Resources */ = {
	isa = PBXShellScriptBuildPhase;
	buildActionMask = 2147483647;
	files = (
	);
	inputPaths = (
		"${PODS_ROOT}/Target Support Files/Pods-gobarber/Pods-gobarber-resources.sh",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Feather.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf",
		"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",
	);
	name = "[CP] Copy Pods Resources";
	outputPaths = (
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Feather.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Brands.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Regular.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Solid.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Fontisto.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Foundation.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Ionicons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialCommunityIcons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialIcons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf",
		"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf",
	);
	runOnlyForDeploymentPostprocessing = 0;
	shellPath = /bin/sh;
	shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-gobarber/Pods-gobarber-resources.sh\"\n";
	showEnvVarsInLog = 0;
};

If not good, try:

Cleaning all pods and reinstalling:

pod cache clean --all # will clean all pods
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
cd ios
pod deintegrate
pod setup
pod install
  • Selecting the ID of the [CP], this case was C07AC2465709E2CC73AB903F and removing all it's ocurrences.

Then the first step.

Other info

Now, for myself, this was the step by step error handling:

After each topic I yarn + yarn ios. If worked, git commit.

  • Installing empty React Native + TS
  • pod Install
  • Copying file structure from base project (the one erroring)
  • Changing Package.json
  • pod install
  • changing app.jsx and index.js
  • Running link

==> ERROR

  • Re-running Link and editing files. Editing new added lines (seen in Git)
    • Removing lines from /* Begin PBXResourcesBuildPhase section */

    • Didnt work. Putting lines back.

    • Removing lines from /* Resources */

    • Didnt work. Putting lines back.

    • Removing line: 2292FCA1B1354EECAC7FADAE /* Resources */,

    • Didnt work, back.

    • Removing lines near /* End PBXFileReference */

    • NO ERROR but no RobotoSlab-Medium

    • Putting lines back and trying next group.

    • Removing lines near /* End PBXBuildFile section */

    • NO ERROR but no RobotoSlab-Medium

    • Back to start.

    • No more lines to remove. Trying another approach.

    • Trying to remove some copied fonts from project line 545

    • WORKED!!!!!!!!!!

    • Gist'in this motherf*cker

    • Trying this on old project and meh, didn't work. Sticking with new project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment