EAS Build for iOS. Metro fails to resolve font

Hi to everyone. I’m struggling with following:
EAS Build fails at the “Run fastlane” step with message:

Metro encountered an error:
Unable to resolve module ./assets/fonts/Poppins-Thin.ttf from /Users/expo/workingdir/build/App.js:

None of these files exist:
  * Poppins-Thin.ttf
  * assets/fonts/Poppins-Thin.ttf/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  11 | function App() {
  12 |   const [loaded] = useFonts({
> 13 |     PoppinsThin: require('./assets/fonts/Poppins-Thin.ttf'),
     |                           ^
  14 |     PoppinsMedium: require('./assets/fonts/Poppins-Medium.ttf'),
  15 |   });
  16 |
Learn more: https://docs.expo.dev/build-reference/troubleshooting

Those tty files are definitely exists at ./assets/fonts folder and all that font stuff works for dev build in iOS simulator or device.
But when I try to build adhoc - it fails.
The only thing I can point is that *.ttf files are added to .gitignore
So, the question is - should I add them to repo?
Thanks to everyone

likely what is happening is that the file is committed to git with different casing (eg: poppins-Thin.ttf) How do I commit case-sensitive only filename changes in Git? - Stack Overflow

also see Troubleshooting build errors and crashes - Expo Documentation

1 Like

Actually build was crashing because *.ttf files were not added to the repo.
And they were not added b/s *.ttf files were part of .gitignore.
As soon as I edited gitignore and pushed fonts to the git I got successful build.
And this kinda confusing me - I don’t remember exactly but it seems .gitignore has been generated by Expo with all those *.png, *.ttf etc files
And now I realise that I DO NEED those files at the git to be able to build app…

expo doesn’t generate a gitignore with ttf, png, etc. not sure what tool may have done that for you

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.