metro: HELP error index.js: The "id" argument must be of type string. Received undefined.
Description
Since i upgraded my react native app to 0.72 i cant run the app anymore .i ve tried to dedupe the duplicates of metro , but here i am stuck with this error .
React Native Version
0.72.0-rc.6
Output of npx react-native info
System: OS: macOS 13.4 CPU: (8) arm64 Apple M1 Memory: 126.47 MB / 8.00 GB Shell: version: “5.9” path: /bin/zsh Binaries: Node: version: 20.3.1 path: /opt/homebrew/bin/node Yarn: version: 4.0.0-rc.45 path: ~/Desktop/projects/labelvie/fid-mobile-copy/node_modules/.bin/yarn npm: version: 9.6.7 path: /opt/homebrew/bin/npm Watchman: version: 2023.06.12.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /Users/walidhousni/.rvm/gems/ruby-3.2.2/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: API Levels: - “31” - “33” Build Tools: - 30.0.2 - 30.0.3 - 33.0.0 - 33.0.2 - 34.0.0 System Images: - android-33 | Google TV Intel x86 Atom - android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 11.0.19 path: /usr/bin/javac Ruby: version: 3.2.2 path: /Users/walidhousni/.rvm/rubies/ruby-3.2.2/bin/ruby npmPackages: “@react-native-community/cli”: installed: 10.0.0 wanted: 10.0.0 react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.0-rc.6 wanted: 0.72.0-rc.6 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: false
Steps to reproduce
react-native start --reset-cache
Snack, code example, screenshot, or link to a repository
import { AppRegistry, Platform } from ‘react-native’; import App from ‘./src/App’; import { name as appName } from ‘./app.json’;
// Here, we require “intl”, which is used in @lingui/macro, but not available in Hermes (used for Android) if (Platform.OS === ‘android’) { global.Intl = require(‘intl’); require(‘intl/locale-data/jsonp/fr.js’); require(‘intl/locale-data/jsonp/en.js’); // add more locales }
AppRegistry.registerComponent(appName, () => App);
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 25 (4 by maintainers)
Commits related to this issue
- Fix mismatched `metro-transform-worker` version - use absolute worker paths Summary: Issues such as https://github.com/facebook/metro/issues/1017 (and similar previously) have had users running into ... — committed to facebook/metro by robhogan a year ago
- Update Metro to ^0.80.0 - don't pin to exact version Summary: Bump to the latest Metro release. This includes minor breaking changes to Metro subpackages that should *not* be visible to RN users. Me... — committed to robhogan/react-native by robhogan 8 months ago
- Update Metro to ^0.80.0 - don't pin to exact version (#41219) Summary: Bump to the latest Metro release. This includes minor breaking changes to Metro subpackages that should *not* be visible to RN ... — committed to robhogan/react-native by robhogan 8 months ago
- Update Metro to ^0.80.0 - don't pin to exact version (#41219) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41219 Bump to the latest Metro release. This includes mino... — committed to facebook/react-native by robhogan 8 months ago
- Update Metro to ^0.80.0 - don't pin to exact version (#41219) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41219 Bump to the latest Metro release. This includes mino... — committed to Othinn/react-native by robhogan 8 months ago
- Fix mismatched `metro-transform-worker` version - use absolute worker paths Summary: Issues such as https://github.com/facebook/metro/issues/1017 (and similar previously) have had users running into ... — committed to facebook/metro by robhogan a year ago
- Fix mismatched `metro-transform-worker` version - use absolute worker paths Summary: Issues such as https://github.com/facebook/metro/issues/1017 (and similar previously) have had users running into ... — committed to facebook/metro by robhogan a year ago
@walidhousni30 It looks like
flipper-serverandflipper-pkg-libare the dependencies bringing in an older version of Metro. Is this a dependency you can update or eliminate?Do also try:
metrodependencies or devDependencies in your project’spackage.json(per @bartolkaruza’s fix)."resolutions"to force the current version of Metro:0.76.5.I have just migrated to 72.4 and started getting the same error. Downgrading @react-native/metro-config to 0.72.9 helped me.
With @react-native/metro-config 0.72.11 I get the following error when building the project:
TypeError: The "id" argument must be of type string. Received undefined error index.js: The "id" argument must be of type string. Received undefinedI had the same issue just now, the solution was removing
"metro-config"from"dependencies": {}. (not dev-dependencies)and there’s literally no answer for that tho
@huntie MAAAAN ITT WOOOORKS THANK YOU SOOO MUCH @bartolkaruza your method works as well i cant thank you enough guys
I commented too soon, glad it’s working for you!
even if it’s in your dev dependencies, it may cause this issue. Try removing it entirely from package.json, then
yarn installto clear it from node_modules@walidhousni30 Great — worth digging up why
metro@npm:0.70.4is there (old version), by tryingyarn why metroetc. Really, there should only be one version of Metro (metro@npm:0.76.5) in your project.From the line numbers reported in the stack trace, it looks like while you’re on
metro@0.76.5, you havemetro-transform-worker0.71.1 or older installed.Please can you run the below and share the result here?
I also note that you are depending on an old version of React Native CLI — React Native 0.72 requires (and depends on)
@react-native-community/cli@11.3.2.⬆️ Sometimes, this can be caused by installed libraries which (problematically) depend on
react-nativedirectly. It could also be from forced dependency versions (e.g. Yarnresolutions— please revert these).To be sure your dependencies are as specified, try also:
Effectively a duplicate of facebook/react-native#34315