Expo config plugin to autolink pnpm workspace packages for iOS CocoaPods
npm install pnpm-pods-autolinkExpo config plugin to automatically link pnpm workspace packages for iOS CocoaPods.
When using pnpm workspaces with Expo and custom native modules, iOS builds fail because CocoaPods can't resolve pnpm's symlinks.
Silent crashes (most frustrating): Your app crashes with no clear error message - often in the React Native bridge or during app startup. The crash appears unrelated to your custom module. Removing the custom module from your code makes the crash go away, but there's no indication that the pod wasn't linked.
How to identify this:
- If your iOS build succeeds but the app crashes when using (or even just importing) a custom Expo module from a workspace package, the pod is likely not linked.
- Run expo run:ios and check the build output - if your custom module is missing from the list of compiled pods, it wasn't linked to the Podfile.
If you're seeing any of these errors, this plugin can help:
``../modules/my-module/ios
[!] Unable to find a podspec in `
``
error: Build input file cannot be found: '/path/to/node_modules/.pnpm/...'
`MyExpoModule
[!] No podspec found for in ../my-module/ios`
``
ld: library not found for -lExpoModulesCore
These occur because:
- pnpm uses symlinks for workspace packages
- CocoaPods doesn't resolve symlinks properly
- Expo's autolinking can't find local modules in pnpm monorepos
- Custom Expo modules in workspace packages aren't linked to the Podfile
This plugin automatically discovers workspace packages that have an ios/ directory with a .podspec file and adds them explicitly to the Podfile.
`bash`
pnpm add pnpm-pods-autolink
Just add the plugin to your app.json:
`json`
{
"expo": {
"plugins": ["pnpm-pods-autolink"]
}
}
The plugin will automatically:
1. Find your pnpm-workspace.yamlios/
2. Scan all workspace packages for directories.podspec
3. Extract pod names from files
4. Add them to the Podfile
`json`
{
"expo": {
"plugins": [
[
"pnpm-pods-autolink",
{
"exclude": ["some-package-to-skip"],
"pods": [
{
"name": "ManualPod",
"path": "../path/to/pod/ios"
}
]
}
]
]
}
}
| Option | Type | Description |
|--------|------|-------------|
| exclude | string[] | Package names to exclude from auto-discovery |pods
| | PodConfig[] | Additional pods to link manually (overrides auto-discovered) |disableAutoDiscovery
| | boolean | Set to true to only use manual pods |
1. Finds the monorepo root by searching for pnpm-workspace.yamlios/
2. Parses the workspace patterns from the YAML file
3. For each matching package directory:
- Checks if it has an directory.podspec
- Looks for a files.name
- Extracts the pod name from in the podspecuse_expo_modules!
4. Adds explicit pod paths to the Podfile after
The plugin adds entries like this to your Podfile:
`ruby
use_expo_modules!
# pnpm workspace pods (auto-generated by pnpm-pods-autolink)
pod 'ExpoAppleMusic', :path => '../expo-apple-music/ios'
`
This plugin solves issues commonly discussed in:
- Expo monorepo setups with pnpm
- Custom Expo modules not being found by CocoaPods
- React Native autolinking failing with pnpm symlinks
- pod install unable to find local podspecs in workspace packages
- Expo SDK 50+
- pnpm workspace with pnpm-workspace.yamlios/
- Custom modules with directory containing a .podspec` file
MIT