Skip to content

TypeError: Cannot read property 'reduce' of undefined #706

Description

@d3-memscube

When I was Trying to build the react-native project using npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle, it gives me something this type of error:

error Cannot read property 'reduce' of undefined.
TypeError: Cannot read property 'reduce' of undefined
at resolveDependencies (C:\Users\souvi\viqud\viqud-app\node_modules\metro\sr
c\DeltaBundler\traverseDependencies.js:644:33)
at C:\Users\souvi\viqud\viqud-app\node_modules\metro\src\DeltaBundler\traver
seDependencies.js:329:33
at Generator.next ()
at asyncGeneratorStep (C:\Users\souvi\viqud\viqud-app\node_modules\metro\src
\DeltaBundler\traverseDependencies.js:137:24)
at _next (C:\Users\souvi\viqud\viqud-app\node_modules\metro\src\DeltaBundler
\traverseDependencies.js:159:9)
at runNextTicks (node:internal/process/task_queues:61:5)
at processTimers (node:internal/timers:497:9)
info Run CLI with --verbose flag for more details.

Please give me a solution how to solve it.

Activity

  1. vitorsierro commented on Jan 11, 2024

    @vitorsierro

    @d3-memscube did you find out why this was happening, I'm getting this same error in my project. just running on another computer is ok

  2. GokuVijay commented on Apr 12, 2024

    @GokuVijay

    @d3-memscube @vitorsierro Anyone found a solution for this ?

  3. robhogan commented on Sep 22, 2026

    @robhogan
    Collaborator

    just running on another computer is ok

    This is very likely a corrupt transform cache entry, particularly seeing that you're using Windows. Metro's file cache serves a zero-prefixed file as a valid hit, and when we deserialise that null the dependencies access is the first error we hit. On Windows an all-zeroes file is exactly what NTFS can leave behind with a crash or power loss mid-write.

    Tracking that specific issue in #1961, so closing this one (apologies it didn't get a response at the time).

    For anyone else in the meantime, --reset-cache (or clearing %TEMP%\metro-cache) should get you unstuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions