Skip to content

[BUG] npm install npm error Cannot read properties of null (reading 'edgesOut') #9787

Not planned

Description

@Jora28

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

This is not just a request to bump a dependency for a CVE

  • This is not solely a request to bump a dependency for a CVE

Current Behavior

3835 verbose stack TypeError: Cannot read properties of null (reading 'edgesOut')
3835 verbose stack at #loadPeerSet (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1289:38)
3835 verbose stack at async #loadPeerSet (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1297:11)
3835 verbose stack at async #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:11)
3835 verbose stack at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
3835 verbose stack at async Promise.all (index 1)
3835 verbose stack at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
3835 verbose stack at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:150:5)
3835 verbose stack at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:207:9)
3835 verbose stack at async module.exports (/usr/lib/node_modules/npm/lib/cli/entry.js:74:5)

{
"name": "nuxt-app",
"private": true,
"scripts": {
"dev": "nuxt dev",
"build": "nuxt build",
"analyze": "nuxt analyze --serve",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"generate-pwa-assets": "pwa-assets-generator",
"typecheck": "nuxt typecheck",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prestart": "test -f .output/server/index.mjs || npm run build",
"start": "node .output/server/index.mjs",
"start:prod": "NODE_ENV=production node .output/server/index.mjs"
},
"engines": {
"node": ">=20.0.0"
},
"devDependencies": {
"@nuxt/eslint-config": "^1.15.2",
"@nuxtjs/device": "^3.2.4",
"@nuxtjs/google-fonts": "^3.2.0",
"@nuxtjs/i18n": "^9.5.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.10",
"@types/lodash-es": "4.17.12",
"@vite-pwa/assets-generator": "^1.0.0",
"@vite-pwa/nuxt": "^1.0.0",
"autoprefixer": "^10.4.21",
"eslint": "^9.39.3",
"nuxt": "3.21.1",
"nuxt-gtag": "^3.0.2",
"nuxt-purgecss": "^2.0.0",
"postcss": "^8.5.1",
"tailwindcss": "^3.4.10"
},
"dependencies": {
"@headlessui/vue": "^1.7.23",
"@heroicons/vue": "^2.2.0",
"@microsoft/signalr": "^8.0.7",
"@nuxt/image": "^1.10.0",
"@pinia/nuxt": "^0.11.0",
"@tawk.to/tawk-messenger-vue-3": "^1.0.3",
"@vuepic/vue-datepicker": "^11.0.2",
"@vueuse/components": "^13.1.0",
"@vueuse/core": "^13.1.0",
"color": "^5.0.0",
"crypto-js": "^4.2.0",
"eventemitter3": "^5.0.1",
"gsap": "^3.12.7",
"lodash-es": "^4.17.21",
"lottie-web": "5.12.2",
"mersenne-twister": "^1.1.0",
"nuxt-toast": "^1.1.4",
"pinia": "^3.0.2",
"qrcode-vue3": "^1.7.1",
"sass": "^1.86.3",
"swiper": "^11.2.6",
"vue-chartjs": "^5.3.3",
"vue3-marquee": "^4.2.2",
"jsqr": "^1.4.0"
}
}
node v22.21.0
npm v10.8.2

Expected Behavior

No response

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm:
  • Node.js:
  • OS Name:
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

Activity

  1. added
    Bug
    Needs Triage
    on Jul 21, 2026
  2. v-kchindam-infy commented on Jul 21, 2026

    @v-kchindam-infy

    @Jora28 I'm unable to reproduce the issue with the current information. Can you please share the exact steps to reproduce the issue. this looks to be similar if not a duplicate of an existing issue #8261

  3. Tkkg1994 commented on Jul 22, 2026

    @Tkkg1994

    I hit this too and managed to reduce it to a one-dependency reproduction. Posting the details since the issue is currently marked as hard to reproduce.

    Minimal reproduction

    {
      "name": "repro",
      "version": "1.0.0",
      "private": true,
      "dependencies": {
        "@vitejs/devtools": "*"
      }
    }
    npm install --package-lock-only
    
    npm error Cannot read properties of null (reading 'edgesOut')
    

    Same crash site as the original report (#loadPeerSet, build-ideal-tree.js:1289). No lock file and no node_modules needed — it fails during ideal-tree construction.

    The trigger is the range, not the resolved version

    This is the part I found most interesting. All three resolve to the same version (0.4.2), but only the wildcard crashes:

    @vitejs/devtools range npm 10.9.8
    "*" Cannot read properties of null (reading 'edgesOut')
    "^0.4.2" OK
    "0.4.2" OK

    Verified deterministic — repeated in fresh directories with a clean cache state, consistently reproducible.

    Version matrix

    Manifest npm 10.9.8 (arborist 8.0.5) npm 11.18.0 (arborist 9.9.0)
    {"@vitejs/devtools": "*"} reading 'edgesOut' (build-ideal-tree.js:1289) reading 'children' (place-dep.js:299)
    {"nuxt": "3.21.1"} reading 'edgesOut' —
    {"nuxt": "4.5.0"} reading 'edgesOut' OK
    {"@nuxt/vite-builder": "4.5.0"} reading 'edgesOut' OK
    {"vite": "*"} OK OK

    Two notes on npm 11: it still crashes on the isolated @vitejs/devtools case, just with a different null dereference. But on a larger real-world manifest that pulls @vitejs/devtools in transitively it resolved fine (1070 packages), presumably because the surrounding constraints keep the graph from reaching the bad state. So npm 11 is not a general fix here.

    Why it's null

    build-ideal-tree.js:1289 in arborist 8.0.5 is:

    const parentEdge = node.parent.edgesOut.get(edge.name)

    so node.parent is null. The stack shows #loadPeerSet recursing into itself (line 1297 → 1289), i.e. the node gets detached from its parent partway through recursive peer-set resolution and is then dereferenced unguarded. The npm 11 failure is the same shape one layer over — virtualRoot.children at place-dep.js:299 with a null virtualRoot.

    The likely reason @vitejs/devtools provokes it is its peer block — four optional peers that are self-referential siblings at the same version, plus a wildcard:

    "peerDependencies": {
      "vite": "*",
      "@vitejs/devtools-rolldown": "^0.4.2",
      "@vitejs/devtools-vite": "^0.4.2",
      "@vitejs/devtools-vitest": "^0.4.2",
      "@vitejs/devtools-oxc": "^0.4.2"
    },
    "peerDependenciesMeta": {
      "@vitejs/devtools-oxc":      { "optional": true },
      "@vitejs/devtools-rolldown": { "optional": true },
      "@vitejs/devtools-vite":     { "optional": true },
      "@vitejs/devtools-vitest":   { "optional": true }
    }

    Each of those sub-packages installs cleanly on its own; only the parent that declares the optional-sibling peer set crashes.

    Why Nuxt users are the ones reporting this

    nuxt → @nuxt/vite-builder → @vitejs/devtools. Since npm auto-installs peers, anything that peer-depends on @nuxt/schema or nuxt drags the whole builder toolchain in. {"nuxt": "3.21.1"} — the version in the original report — reproduces the exact edgesOut error as a single dependency on npm 10.

    I ran into it in a different context: a Nuxt/Nitro server bundle that externalises a package peer-depending on @nuxt/schema, deployed to Firebase Cloud Functions. The Node 22 buildpack ships npm 10, so the deploy build died with this error while a local npm 11 install of the same manifest succeeded.

    Workaround

    Skipping peer auto-install avoids it, since none of that tooling is needed at runtime:

    # .npmrc
    legacy-peer-deps=true
    

    Confirmed: {"@vitejs/devtools": "*"} goes from crash to OK on npm 10.9.8 with that set. Pinning the offending package to an exact or caret range instead of * also works, where you control the range.

    Environment

    npm:  10.9.8 (arborist 8.0.5) — crashes
    npm:  11.18.0 (arborist 9.9.0) — crashes differently on the isolated case
    Node: v24.15.0
    OS:   Windows 11 (26200); also reproduces on the Linux Node 22 GCP buildpack
    

    @vitejs/devtools resolved to 0.4.2 at time of testing — noting it since the * range is what makes this reproduce, so future registry state may shift which version you land on.

  4. AswinDhurai01 commented on Jul 28, 2026

    @AswinDhurai01

    @Jora28 Actually, I also faced this issue. This issue is resolved by updating the nodejs and npm version to their latest versions.
    Upgraded Node.js (v22.21.1 → v24.x) and npm (v10.9.4 → v11.x), resolving the npm install failure.

  5. changed the title [-][BUG] <title> npm install npm error Cannot read properties of null (reading 'edgesOut')[/-] [+][BUG] npm install npm error Cannot read properties of null (reading 'edgesOut')[/+] on Jul 29, 2026
  6. blove commented on Aug 9, 2026

    @blove

    I hit this through a generated application, then reduced that real-world graph to a second one-dependency reproduction that may help pin the affected peer-set shape.

    Minimal reproduction

    {
      "name": "vitest-edgesout-repro",
      "version": "1.0.0",
      "private": true,
      "devDependencies": {
        "vitest": "4.1.4"
      }
    }

    From a fresh directory with no lock file or node_modules:

    npx --yes [email protected] install --package-lock-only --ignore-scripts

    Result:

    npm error Cannot read properties of null (reading 'edgesOut')
    

    The verbose stack is the same recursive #loadPeerSet path reported above:

    at #loadPeerSet (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js:1289:38)
    at async #loadPeerSet (.../build-ideal-tree.js:1297:11)
    at async #loadPeerSet (.../build-ideal-tree.js:1297:11)
    at async #loadPeerSet (.../build-ideal-tree.js:1297:11)
    

    I repeated it with a new, isolated npm cache and --prefer-online; it failed identically.

    Version boundary

    Using otherwise identical one-dependency manifests:

    Manifest npm 10.9.9
    [email protected] crashes reading edgesOut
    [email protected] crashes reading edgesOut
    [email protected] succeeds
    vitest@^4.1.10 succeeds

    For [email protected]:

    npm Result
    10.9.9 crashes reading edgesOut
    11.19.0 succeeds
    12.0.2 succeeds

    --legacy-peer-deps also makes the npm 10.9.9 install succeed.

    The npm 10 verbose fetch sequence reaches @vitejs/devtools and its optional sibling peers immediately before the recursive #loadPeerSet failure, so this appears consistent with the optional-peer analysis in the reproduction above. The original application dependency graph is not required to trigger it.

    Environment:

    Node: v24.18.0
    OS: macOS / Darwin 25.5.0, arm64
    npm: 10.9.9, 11.19.0, 12.0.2
    
  7. erwanriou commented on Aug 18, 2026

    @erwanriou

    Deterministic reproduction (hit us in CI twice in 2 months; this instance reproduces locally every time):

    { "devDependencies": { "vitest": "4.1.10", "jsdom": "29.1.1", "vite": "7.1.1" } }

    npm install --force (no lockfile) -> TypeError: Cannot read properties of null (reading 'edgesOut') at #loadPeerSet (build-ideal-tree.js:1297), npm 10.9.2 / node 22.13.1.

    Trigger: [email protected] was published ~90 seconds before our install ran. vitest declares its family (@vitest/browser-playwright, @vitest/coverage-v8, ...) as optional peers pinned to its own version; with the root pinned to 4.1.10 and the registry's latest at 4.1.11, evaluating that optional peer set - for packages we never install - crashes the resolver instead of raising a readable ERESOLVE. Aligning the root pin to 4.1.11 makes the install pass, which is how we isolated the peer-set version skew as the trigger.

    Notable: the crash comes from the declaration of an optional peer alone - @vitest/browser-playwright is never installed in this tree (npm ls -> empty).

    Full --verbose stack and debug log available on request.

  8. 52 remaining items

  9. RicardoRB commented on Oct 29, 2026

    @RicardoRB

    We hit the same edgesOut crash and tested which npm versions are affected. Repro and results:

    Repro (empty directory, no lockfile, Node 22.12.0):

    echo '{"name":"x","private":true}' > package.json
    npm install [email protected]
    

    Results

    npm Result
    10.9.0 (bundled with Node 22.12) fails: Cannot read properties of null (reading 'edgesOut')
    10.9.9 (newest npm 10.x) fails, same error
    11.5.2 fails, same error
    11.6.0 installs
    11.21.1 installs

    The same npm 10.9.9 also fails on Node 22.23.4, so a newer Node 22 patch doesn't avoid it. [email protected] installs on npm 10.9.x.

    Takeaway for us: the crash needs npm 11.6.0 or later. Node 22 still bundles npm 10.9.x, so CI on Node 22 has to upgrade npm first. If you want a different repro, we can provide one.

  10. khaled-maruf commented on Nov 5, 2026

    @khaled-maruf

    3. @Jora28 I'm unable to reproduce the issue with the current information. Can you please share the exact steps to reproduce the issue. this looks to be similar if not a duplicate of an existing issue #8261

    @v-kchindam-infy , any reason #8261 was fixed in 11+ but not in 10+ which gets shipped with node22?

  11. khaled-maruf commented on Nov 5, 2026

    @khaled-maruf

    28. > 3. @Jora28 I'm unable to reproduce the issue with the current information. Can you please share the exact steps to reproduce the issue. this looks to be similar if not a duplicate of an existing issue #8261

     [@v-kchindam-infy](https://github.com/v-kchindam-infy) , any reason [#8261](https://github.com/npm/cli/issues/8261) was fixed in 11+ but not in 10+ which gets shipped with node22?
    

    cc: @milaninfy @isaacs

  12. Thoemmy commented on Nov 13, 2026

    @Thoemmy

    We have the same problem with edges out and funny is the fact that it also includes vite as some indicator.

    vite and @vitejs/devtools is installed in our angular project and since then i need to make overrides in the package.json of vite so that the "null" error of edgesOut is dissapearing.

  13. haigou-web commented on Nov 13, 2026

    @haigou-web

    Checked the actually shipped code rather than the changelog, since this decides whether a 10.x backport is even possible.

    The guard does not exist anywhere on the 8.x line.

    [email protected] (latest 10.x) still pins @npmcli/arborist@^8.0.5, and 8.0.5 is the last release on that branch. Fetching lib/arborist/build-ideal-tree.js from each tag and grepping for the guard:

    arborist if (!node.parent) guard npm that ships it
    8.0.5 absent 10.9.10 (latest 10.x)
    9.1.3 absent 11.5.0
    9.1.4 present 11.6.0
    9.9.3 present 11.21.2 (latest 11.x)
    10.0.4 present 12.2.2 (latest)

    So it isn't "fixed in 11 but forgotten for 10" — the fix was never applied to the major line npm 10 consumes, and that line has had no release since 8.0.5. Nothing on 8.x can pick it up by a dependency bump.

    That does not answer whether maintainers intend to backport it — that's their call, I'm just here from the same crash. But it explains the shape of the problem: Node 22 still bundles npm 10.9.x, so anyone on Node 22 needs either #8448 landing on arborist 8.x, or to upgrade npm independently of Node.

    Practical escape hatch for the Node 22 crowd — verified by @kimbutton in the comment above: run npx --yes npm@11 install once to regenerate the lockfile, then the original npm 10.9.x consumes it fine for both install and ci. The bug only bites during ideal-tree construction, not when reading an already-resolved lockfile.

    --legacy-peer-deps is not an alternative — the same comment found it produces a lockfile that then fails npm ci with Missing: [email protected] from lock file.

  14. khaled-maruf commented on Nov 13, 2026

    @khaled-maruf

    Checked the actually shipped code rather than the changelog, since this decides whether a 10.x backport is even possible.

    The guard does not exist anywhere on the 8.x line.

    [email protected] (latest 10.x) still pins @npmcli/arborist@^8.0.5, and 8.0.5 is the last release on that branch. Fetching lib/arborist/build-ideal-tree.js from each tag and grepping for the guard:

    arborist if (!node.parent) guard npm that ships it
    8.0.5 absent 10.9.10 (latest 10.x)
    9.1.3 absent 11.5.0
    9.1.4 present 11.6.0
    9.9.3 present 11.21.2 (latest 11.x)
    10.0.4 present 12.2.2 (latest)
    So it isn't "fixed in 11 but forgotten for 10" — the fix was never applied to the major line npm 10 consumes, and that line has had no release since 8.0.5. Nothing on 8.x can pick it up by a dependency bump.

    That does not answer whether maintainers intend to backport it — that's their call, I'm just here from the same crash. But it explains the shape of the problem: Node 22 still bundles npm 10.9.x, so anyone on Node 22 needs either #8448 landing on arborist 8.x, or to upgrade npm independently of Node.

    Practical escape hatch for the Node 22 crowd — verified by @kimbutton in the comment above: run npx --yes npm@11 install once to regenerate the lockfile, then the original npm 10.9.x consumes it fine for both install and ci. The bug only bites during ideal-tree construction, not when reading an already-resolved lockfile.

    --legacy-peer-deps is not an alternative — the same comment found it produces a lockfile that then fails npm ci with Missing: [email protected] from lock file.

    Practical escape hatch for the Node 22 crowd — verified by @kimbutton in the comment above: run npx --yes npm@11 install once to regenerate the lockfile

    It doesn't look like a practical escape hatch TBH. If Node 22 is still in maintenance phase then anything coming with it shouldn't contain things that breaks existing usages. That's what maintenance is all about. If upgrading to npm11 is the solution, then that should've been shipped by the package itself.

  15. nkolev92 commented on Nov 24, 2026

    @nkolev92
    Contributor

    Hey folks,
    Thank you for the discussion.

    As indicated, 10 and 11 use different versions of arborist and at this point, we're only considering security fixes for 10, and don't want to add additional risk.

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

    BugRelease 10.xTriage Requestedcmd:installws:arborist

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions