Hi all I’m trying to run an iOS build on EAS from a managed workflow app. When I run eas build --platform ios
locally the job fails on the install pods
section. This is what the error says.
[stderr] node:internal/modules/cjs/loader:998
[stderr] throw err;
[stderr] ^
[stderr] Error: Cannot find module 'expo-modules-autolinking/package.json'
[stderr] Require stack:
[stderr] - /Users/expo/workingdir/build/apps/mobile/ios/[eval]
[stderr] at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
[stderr] at Function.resolve (node:internal/modules/cjs/helpers:109:19)
[stderr] at [eval]:1:9
[stderr] at Script.runInThisContext (node:vm:129:12)
[stderr] at Object.runInThisContext (node:vm:313:38)
[stderr] at node:internal/process/execution:79:19
[stderr] at [eval]-wrapper:6:22
[stderr] at evalScript (node:internal/process/execution:78:60)
[stderr] at node:internal/main/eval_string:28:3 {
[stderr] code: 'MODULE_NOT_FOUND',
[stderr] requireStack: [ '/Users/expo/workingdir/build/apps/mobile/ios/[eval]' ]
[stderr] }
[stderr] Node.js v18.12.1
[!] Invalid `Podfile` file: cannot load such file -- ./scripts/ios/autolinking_manager.
# from /Users/expo/workingdir/build/apps/mobile/ios/Podfile:1
# -------------------------------------------
> require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
# -------------------------------------------
Error: Unknown error. See logs for more information.
I don’t have this package installed or do I think I need to have that. Any ideas what could be happening here?
I am using a pnpm managed monorepo if that helps.
Hi @mike.fisher,
This package is used internally by the EAS Build process to install pods for libraries’ that require native code. You can see more info about AutoLinking here: Autolinking - Expo Documentation
Since its a monorepo, I’d suggest looking at our monorepos guide to make sure that you are setting it up correctly (we recommend using Yarn workspaces in the guide): Working with Monorepos - Expo Documentation to make sure the setup is correct. In the Common Issues section, we do suggest some rules for other tools: Can I use another tool instead of Yarn workspaces.
Hi @amanhimself thanks for getting back to me. I was able to get a build to complete but I’m not sure the app will run properly. The issue was indeed due to monorepo issues.
So originally I did follow the “working with monorepos” guide. I know you suggest yarn workspaces but pnpm seems to be a much more flexible and performance solution for monorepos nowadays so the team went in that direction.
The problem with pnpm is it stores everything in these .pnpm
folders and does some symlinking magic to make it all work. This didn’t work well with Expo and react native though. The expo docs say turn on the node-linker=hoisted
flag in .npmrc
which makes pnpm behave more like yarn workspaces. I did do that most things in my expo app seemed to work fine.
The problem is we use a 3rd party auth solution called Magic Auth. However I encountered issues when I tried to integrate Magic Auth’s SDK for React Native:
https://magic.link/docs/auth/login-methods/email/integration/react-native
The only way I could work around this was to change my metro config to use rnx-kit/metro-config
and rnx-kit/metro-resolver-symlinks
I then removed the node-linker=hoisted
flag from .npmrc
because it moves all the node_modules packages into their own app
and packages
folder as opposed to a large sock drawer of dependencies at the root of the monorepo.
Everything worked fine in the app. However when I started to run a build I got the above error:
[stderr] Error: Cannot find module 'expo-modules-autolinking/package.json'
However I was just able to get a build to complete by going to the original metro config and turning node-linker=hoisted
back on.
Sadly I don’t think this will work with my authentication SDK library and I don’t love the idea of all dependencies in my monorepo living in the same folder, so I’m in a bit of a catch 22. Any thoughts on how you’d proceed here?