Error when building an iOS dev client

We are on the managed workflow with a monorepo running Yarn 3. Our .yarnrc.yml config for the mobile app directory has nmHoistingLimits: workspaces so none of our dependencies are hoisted.

eas-cli version:
eas-cli/3.1.1 darwin-arm64 node-v16.13.0

When I try to create an eas dev client with eas build --profile demo --platform ios, I’m getting the following error:

Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
[stderr] node:internal/modules/cjs/loader:988
[stderr]   throw err;
[stderr]   ^
[stderr] Error: Cannot find module 'react-native/package.json'
[stderr] Require stack:
[stderr] - /Users/expo/workingdir/build/node_modules/expo-dev-menu/[eval]
[stderr]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
[stderr]     at Function.Module._load (node:internal/modules/cjs/loader:833:27)
[stderr]     at Module.require (node:internal/modules/cjs/loader:1057:19)
[stderr]     at require (node:internal/modules/cjs/helpers:103:18)
[stderr]     at [eval]:1:1
[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]   code: 'MODULE_NOT_FOUND',
[stderr]   requireStack: [ '/Users/expo/workingdir/build/node_modules/expo-dev-menu/[eval]' ]
[stderr] }
[!] Failed to load 'expo-dev-menu' podspec: 
[!] Invalid `expo-dev-menu.podspec` file: no implicit conversion of nil into String.
 #  from /Users/expo/workingdir/build/node_modules/expo-dev-menu/expo-dev-menu.podspec:24
 #  -------------------------------------------
 #  
 >  folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion + ' -DRNPATCHVERSION=' + rnPatchVersion
 #  folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
 #  -------------------------------------------
pod exited with non-zero code: 1

I originally thought it might be an issue with expo-dev-menu getting hoisted and not seeing the react-native package. But as I mentioned above, we have yarn 3 configured to not hoist dependencies. I also checked my local node_modules directory, and both react-native and expo-dev-menu are there.

Any ideas what might be wrong?

For any Expo developers who see this, here’s a link to the build:

Hi @lehresman! I checked the build log, and it seems that the nmHoistingLimits: workspaces is not doing what it’s supposed to do.

In the error, you can see the path of the error originating from:

/Users/expo/workingdir/build/node_modules/expo-dev-menu/[eval]

The root location within the EAS build worker is set to /Users/expo/workingdir/build, meaning that the expo-dev-menu package (dependency of expo-dev-client) is installed in the root node_modules folder. If react-native is installed inside /apps/mobile/node_modules (or just /mobile/node_modules) that would explain this error.

Can you provide a repository that matches your configuration? You can swap out the app with the default app template from npx create-expo-app. It’s the yarn/repo setup that I’m most interested in.

Cheers,
Cedric

1 Like

Thanks for getting back with me so quickly Cedric.

I’ll work on creating a minimal use case build that I can share. Hope to have that for you yet today.

Locally I can confirm that nmHoistingLimits: workspaces is being honored. One thing I’m doing that might be unexpected by EAS is that I have a .yarnrc.yml in my monorepo root directory that has nmHoistingLimits: none but in the mobile app project directory I have an override .yarnrc.yml that has nmHoistingLimits: workspaces.

I’ll show you what I mean when I create the minimal reproduction repository.

Hmm, that might be the problem. You could try this:

  1. Only have a single root .yarnrc.yml
  2. In the Expo workspace package.json, set "installConfig": { "hoistingLimits": "workspaces" } (as described in the docs)

EAS Build runs yarn install in the root of the monorepo. That might “mess up” the other .yarnrc.yml. But, the package.json seems to be a good way of achieving the same thing.

Thanks a ton Cedric, that worked!

For posterity (if anyone else finds this), all I did was deleted .yarnrc.yml in my package subdirectory (the one that had nmHoistingLimits: workspaces. I then modified the root packages.json to include "installConfig": { "hoistingLimits": "workspaces" }.

Worked like a charm.

2 Likes