SDK 49: metro bundler error

If I run a fresh npx create-expo-app my-app and set "bundler": "metro" in app.json, I get this error:

Web Bundling failed 471ms
error: node_modules/expo/AppEntry.js: The "id" argument must be of type string. Received undefined

Without setting "bundler": "metro", the app works.

Am I missing something?

Hey @jmbldwn,

Unable to reproduce the error on my end. Can you please share more info about how you are setting it in app.json? Typically, the app.json will look as following:

{
  "expo": {
    "web": {
      "bundler": "metro"
    }
  }
}

The bundler property has to be set under expo.web.

Hmmm. It may be related to yarn 3.5.0, which we migrated to recently. I can confirm this issue doesn’t arise in yarn 1.22.19.

Is moving to the latest yarn supported? If not, what’s the recommendation if we build in a monorepo?

Yarn v2+ isn’t supported well in React Native. For reference, I’m sharing the comment on a similar issue that relates to Yarn v2 here: [docs] "yarn create expo" suggests commands that don't work · Issue #23116 · expo/expo · GitHub. TLDR from it is that you can fix it by adding the nodeLinker in your yarn config: In .yarnrc.yml in your project, add nodeLinker: node-modules.

We do have a guide on Yarn 1 workspaces for monorepos and for other package managers, you can also view common questions in the same guide: Work with monorepos - Expo Documentation

Hmmm. We have nodeLinker: node-modules in our .yarnrc.yml.

Should we go back to npm? pnpm? nx?

If there are 5 Twitters, why not 5 package managers?

If you switch to pnpm or npm, please follow the monorepo guide. Basically, this part: “Change that by adding a .npmrc file with node-linker=hoisted (see docs).”

I guess I want to know which one will be best supported. What’s expo’s official position?

We don’t have something in the immediate roadmap for something like that.