[BUG] npm ERR! Cannot read properties of null (reading 'package') · Issue #4787 · npm/cli · GitHub
Skip to content

[BUG] npm ERR! Cannot read properties of null (reading 'package') #4787

Closed

Description

@arimus

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

Current Behavior

I do an initial npm install, which works fine. Subsequent runs result in the error:

...
111 timing command:i Completed in 1071ms
112 verbose stack TypeError: Cannot read properties of null (reading 'package')
112 verbose stack     at Link.set root [as root] (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:718:35)
112 verbose stack     at Link.replace (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1155:17)
112 verbose stack     at PlaceDep.replaceOldDep (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:426:17)
112 verbose stack     at PlaceDep.placeInTree (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:304:12)
112 verbose stack     at PlaceDep.place (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:214:10)
112 verbose stack     at new PlaceDep (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:71:10)
112 verbose stack     at /Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:984:31
112 verbose stack     at Array.map (<anonymous>)
112 verbose stack     at Arborist.[buildDepStep] (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:984:8)
112 verbose stack     at async Arborist.buildIdealTree (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
113 verbose cwd /Users/arimus/workspace/appbuilder-backend

Expected Behavior

npm install not failing with the above error.

Steps To Reproduce

Environment
Starting with NPM v8.6.0 (8.5.5 does not have this issue)

Config
A package.json with a tgz file dependency. Example:

{
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "license": "",
  "repository": {
    "url": "http://github.com:arimus/test.git"
  },
  "author": "arimus",
  "scripts": {
    "tsc": "tsc --project tsconfig.json",
    "start": "node ./dist/index.js",
  },
  "dependencies": {
    "apollo-server-hapi": "./apollo-server-hapi-3.5.1.tgz"
  }
}

Run

npm i

Error

...
111 timing command:i Completed in 1071ms
112 verbose stack TypeError: Cannot read properties of null (reading 'package')
112 verbose stack     at Link.set root [as root] (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:718:35)
112 verbose stack     at Link.replace (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1155:17)
112 verbose stack     at PlaceDep.replaceOldDep (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:426:17)
112 verbose stack     at PlaceDep.placeInTree (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:304:12)
112 verbose stack     at PlaceDep.place (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:214:10)
112 verbose stack     at new PlaceDep (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:71:10)
112 verbose stack     at /Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:984:31
112 verbose stack     at Array.map (<anonymous>)
112 verbose stack     at Arborist.[buildDepStep] (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:984:8)
112 verbose stack     at async Arborist.buildIdealTree (/Users/arimus/.nvm/versions/node/v16.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
113 verbose cwd /Users/arimus/workspace/appbuilder-backend

Environment

  • npm: 8.6.0+
  • Node.js: v16.13.1
  • OS Name: OSX
  • npm config:
; node bin location = /Users/arimus/.nvm/versions/node/v16.13.1/bin/node
; cwd = /Users/arimus/workspace/appbuilder-backend
; HOME = /Users/arimus
; Run `npm config ls -l` to show all defaults.

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 8.xwork is associated with a specific npm 8 release
    on Apr 21, 2022
  2. BobFrankston commented on Jun 12, 2022

    @BobFrankston

    This is frustrating because I can look at the log and find out the call stack, but it doesn't help me in fixing the problem. I accept that it's my error, but it would save many hours if there were more information about the source of the error.

    In my case, I get Cannot read properties of null (reading 'package'). I'm using symbolic links, so there may be an inconsistency, but how can I find it? I can attach the log though I'm wary about posting specific info.

    The line

    37 verbose shrinkwrap failed to load node_modules/.package-lock.json missing from lockfile: ../mlib/node_modules/ansi-styles
    

    hints at the problem but it works in other contexts

  3. silentcloud commented on Jun 13, 2022

    @silentcloud

    +1
    node 16.15.1
    npm 8.11.0

  4. lesliesu commented on Jun 22, 2022

    @lesliesu

    +1
    node 16.13.2
    npm 8.1.2

  5. AlekhyaYalla commented on Jul 13, 2022

    @AlekhyaYalla

    Any update on this issue? I'm facing this issue

  6. david-987 commented on Jul 17, 2022

    @david-987

    +1 npm cache clear --force doesn't work which is my go-to when npm bugs out.
    npm 8.1.4
    node 16.14

  7. Zakyyy commented on Jul 19, 2022

    @Zakyyy

    same

  8. jerinkalexander commented on Jul 20, 2022

    @jerinkalexander

    128 verbose node v16.15.1
    129 verbose npm v8.14.0
    130 error Cannot read properties of null (reading 'children')
    131 verbose exit 1

    Same here while running npm link.

  9. andrey-helldar commented on Jul 24, 2022

    @andrey-helldar

    Node 16.16 and Npm 8.11 and 8.15 too

    Show log
    0 verbose cli C:\Users\Helldar\AppData\Local\nvs\default\node.exe C:\Users\Helldar\AppData\Local\nvs\default\node_modules\npm\bin\npm-cli.js
    1 info using npm@8.11.0
    2 info using node@v16.16.0
    3 timing npm:load:whichnode Completed in 0ms
    4 timing config:load:defaults Completed in 3ms
    5 timing config:load:file:C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\npmrc Completed in 1ms
    6 timing config:load:builtin Completed in 1ms
    7 timing config:load:cli Completed in 1ms
    8 timing config:load:env Completed in 0ms
    9 timing config:load:file:D:\domains\volunteers\web\.npmrc Completed in 0ms
    10 timing config:load:project Completed in 1ms
    11 timing config:load:file:C:\Users\Helldar\.npmrc Completed in 0ms
    12 timing config:load:user Completed in 0ms
    13 timing config:load:file:C:\Users\Helldar\AppData\Local\nvs\default\etc\npmrc Completed in 1ms
    14 timing config:load:global Completed in 1ms
    15 timing config:load:validate Completed in 0ms
    16 timing config:load:credentials Completed in 0ms
    17 timing config:load:setEnvs Completed in 1ms
    18 timing config:load Completed in 9ms
    19 timing npm:load:configload Completed in 9ms
    20 timing npm:load:mkdirpcache Completed in 1ms
    21 timing npm:load:mkdirplogs Completed in 0ms
    22 verbose title npm i
    23 verbose argv "i"
    24 timing npm:load:setTitle Completed in 1ms
    25 timing config:load:flatten Completed in 2ms
    26 timing npm:load:display Completed in 3ms
    27 verbose logfile logs-max:10 dir:C:\Users\Helldar\AppData\Local\npm-cache\_logs
    28 verbose logfile C:\Users\Helldar\AppData\Local\npm-cache\_logs\2022-07-24T10_07_31_732Z-debug-0.log
    29 timing npm:load:logFile Completed in 3ms
    30 timing npm:load:timers Completed in 0ms
    31 timing npm:load:configScope Completed in 0ms
    32 timing npm:load Completed in 17ms
    33 timing arborist:ctor Completed in 0ms
    34 silly logfile start cleaning logs, removing 1 files
    35 silly logfile done cleaning log files
    36 timing arborist:ctor Completed in 0ms
    37 timing idealTree:init Completed in 9ms
    38 timing idealTree:userRequests Completed in 0ms
    39 silly idealTree buildDeps
    40 silly fetch manifest @cloudgeek/vue3-video-player@^0.3.10
    41 http fetch GET 200 https://registry.npmjs.org/@cloudgeek%2fvue3-video-player 300ms (cache miss)
    42 silly fetch manifest @mdi/font@^6.2.0
    43 http fetch GET 200 https://registry.npmjs.org/@mdi%2ffont 128ms (cache miss)
    44 silly fetch manifest apexcharts@^3.35.3
    45 http fetch GET 200 https://registry.npmjs.org/apexcharts 64ms (cache miss)
    46 silly fetch manifest axios@^0.27.2
    47 http fetch GET 200 https://registry.npmjs.org/axios 45ms (cache miss)
    48 silly fetch manifest laravel-vue-i18n@^2.1.1
    49 http fetch GET 200 https://registry.npmjs.org/laravel-vue-i18n 47ms (cache miss)
    50 silly fetch manifest laravel-mix@^6.0.43
    51 http fetch GET 200 https://registry.npmjs.org/laravel-mix 57ms (cache miss)
    52 silly fetch manifest postcss@^8.4.14
    53 http fetch GET 200 https://registry.npmjs.org/postcss 43ms (cache miss)
    54 silly fetch manifest lodash@^4.17.21
    55 http fetch GET 200 https://registry.npmjs.org/lodash 58ms (cache miss)
    56 silly fetch manifest maska@^1.5.0
    57 http fetch GET 200 https://registry.npmjs.org/maska 39ms (cache miss)
    58 silly fetch manifest moment@^2.29.3
    59 http fetch GET 200 https://registry.npmjs.org/moment 51ms (cache miss)
    60 silly fetch manifest moment-duration-format@^2.3.2
    61 http fetch GET 200 https://registry.npmjs.org/moment-duration-format 54ms (cache miss)
    62 silly fetch manifest moment-timezone@^0.5.34
    63 http fetch GET 200 https://registry.npmjs.org/moment-timezone 58ms (cache miss)
    64 silly fetch manifest pinia@^2.0.14
    65 http fetch GET 200 https://registry.npmjs.org/pinia 51ms (cache miss)
    66 silly fetch manifest @vue/composition-api@^1.4.0
    67 http fetch GET 200 https://registry.npmjs.org/@vue%2fcomposition-api 152ms (cache miss)
    68 silly fetch manifest vue@^3.2.25
    69 http fetch GET 200 https://registry.npmjs.org/vue 69ms (cache miss)
    70 silly fetch manifest vue@>= 2.5 < 2.7
    71 silly fetch manifest typescript@^4.5.4
    72 http fetch GET 200 https://registry.npmjs.org/typescript 142ms (cache miss)
    73 silly fetch manifest pinia-plugin-persistedstate@^1.6.3
    74 http fetch GET 200 https://registry.npmjs.org/pinia-plugin-persistedstate 45ms (cache miss)
    75 silly fetch manifest query-string@^7.1.1
    76 http fetch GET 200 https://registry.npmjs.org/query-string 41ms (cache miss)
    77 silly fetch manifest roboto-fontface@*
    78 http fetch GET 200 https://registry.npmjs.org/roboto-fontface 42ms (cache miss)
    79 silly fetch manifest vue-router@^4.0.16
    80 http fetch GET 200 https://registry.npmjs.org/vue-router 54ms (cache miss)
    81 silly fetch manifest vue-toastification@^2.0.0-rc.5
    82 http fetch GET 200 https://registry.npmjs.org/vue-toastification 47ms (cache miss)
    83 silly fetch manifest vue3-apexcharts@^1.4.1
    84 http fetch GET 200 https://registry.npmjs.org/vue3-apexcharts 42ms (cache miss)
    85 silly fetch manifest vue3-audio-player@^1.0.5
    86 http fetch GET 200 https://registry.npmjs.org/vue3-audio-player 42ms (cache miss)
    87 silly fetch manifest vue3-openlayers@^0.1.68
    88 http fetch GET 200 https://registry.npmjs.org/vue3-openlayers 48ms (cache miss)
    89 silly fetch manifest vue3-telegram-login@^0.0.4
    90 http fetch GET 200 https://registry.npmjs.org/vue3-telegram-login 48ms (cache miss)
    91 silly fetch manifest vuetify@^3.0.0-beta.5
    92 http fetch GET 200 https://registry.npmjs.org/vuetify 62ms (cache miss)
    93 silly fetch manifest @formatjs/intl@^1.0.0 || ^2.0.0
    94 http fetch GET 200 https://registry.npmjs.org/@formatjs%2fintl 157ms (cache miss)
    95 silly fetch manifest vite-plugin-vuetify@^1.0.0-alpha.0
    96 http fetch GET 200 https://registry.npmjs.org/vite-plugin-vuetify 62ms (cache miss)
    97 silly fetch manifest vite-plugin-vuetify@1.0.0-alpha.12
    98 silly fetch manifest vite@^2.9.9
    99 http fetch GET 200 https://registry.npmjs.org/vite 75ms (cache miss)
    100 silly fetch manifest less@*
    101 http fetch GET 200 https://registry.npmjs.org/less 49ms (cache miss)
    102 silly fetch manifest sass@^1.53.0
    103 http fetch GET 200 https://registry.npmjs.org/sass 53ms (cache miss)
    104 silly fetch manifest stylus@*
    105 http fetch GET 200 https://registry.npmjs.org/stylus 57ms (cache miss)
    106 silly fetch manifest vue-i18n@^9.0.0
    107 http fetch GET 200 https://registry.npmjs.org/vue-i18n 54ms (cache miss)
    108 silly fetch manifest webpack-plugin-vuetify@2.0.0-alpha.11
    109 http fetch GET 200 https://registry.npmjs.org/webpack-plugin-vuetify 77ms (cache miss)
    110 silly fetch manifest @vue/compiler-sfc@^3.2.6
    111 http fetch GET 200 https://registry.npmjs.org/@vue%2fcompiler-sfc 74ms (cache miss)
    112 silly fetch manifest webpack@^5.0.0
    113 http fetch GET 200 https://registry.npmjs.org/webpack 124ms (cache miss)
    114 silly fetch manifest webfontloader@^1.0.0
    115 http fetch GET 200 https://registry.npmjs.org/webfontloader 49ms (cache miss)
    116 silly fetch manifest @babel/core@^7.18.6
    117 http fetch GET 200 https://registry.npmjs.org/@babel%2fcore 57ms (cache miss)
    118 silly fetch manifest @babel/plugin-proposal-class-properties@^7.18.6
    119 http fetch GET 200 https://registry.npmjs.org/@babel%2fplugin-proposal-class-properties 52ms (cache miss)
    120 silly fetch manifest @babel/plugin-proposal-optional-chaining@^7.18.6
    121 http fetch GET 200 https://registry.npmjs.org/@babel%2fplugin-proposal-optional-chaining 58ms (cache miss)
    122 silly fetch manifest @popperjs/core@^2.11.5
    123 http fetch GET 200 https://registry.npmjs.org/@popperjs%2fcore 89ms (cache miss)
    124 silly fetch manifest @types/lodash@^4.14.182
    125 http fetch GET 200 https://registry.npmjs.org/@types%2flodash 63ms (cache miss)
    126 silly fetch manifest @types/node@^18.0.5
    127 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 69ms (cache miss)
    128 silly fetch manifest @types/webfontloader@^1.0.0
    129 http fetch GET 200 https://registry.npmjs.org/@types%2fwebfontloader 66ms (cache miss)
    130 silly fetch manifest @vitejs/plugin-vue@^2.3.3
    131 http fetch GET 200 https://registry.npmjs.org/@vitejs%2fplugin-vue 89ms (cache miss)
    132 silly fetch manifest autoprefixer@^10.4.7
    133 http fetch GET 200 https://registry.npmjs.org/autoprefixer 56ms (cache miss)
    134 silly fetch manifest eslint@^8.18.0
    135 http fetch GET 200 https://registry.npmjs.org/eslint 48ms (cache miss)
    136 silly fetch manifest eslint-plugin-prettier@^4.2.1
    137 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-prettier 59ms (cache miss)
    138 silly fetch manifest prettier@>=2.0.0
    139 http fetch GET 200 https://registry.npmjs.org/prettier 63ms (cache miss)
    140 silly fetch manifest eslint-plugin-you-dont-need-lodash-underscore@^6.12.0
    141 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-you-dont-need-lodash-underscore 45ms (cache miss)
    142 silly fetch manifest postcss-import@^14.1.0
    143 http fetch GET 200 https://registry.npmjs.org/postcss-import 42ms (cache miss)
    144 silly fetch manifest vite@^2.7.0
    145 silly fetch manifest sass@*
    146 silly fetch manifest vuetify@^3.0.0-beta.4
    147 silly fetch manifest typescript@^4.5
    148 silly fetch manifest vue@^3.2.0
    149 timing idealTree Completed in 3734ms
    150 timing command:i Completed in 3743ms
    151 verbose stack TypeError: Cannot read properties of null (reading 'explain')
    151 verbose stack     at Arborist.[explainPeerConflict] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1434:29)
    151 verbose stack     at Arborist.[failPeerConflict] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1427:44)
    151 verbose stack     at Arborist.[loadPeerSet] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1394:34)
    151 verbose stack     at async Arborist.[buildDepStep] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:976:11)
    151 verbose stack     at async Arborist.buildIdealTree (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:218:7)
    151 verbose stack     at async Promise.all (index 1)
    151 verbose stack     at async Arborist.reify (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:153:5)
    151 verbose stack     at async Install.exec (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\lib\commands\install.js:156:5)
    151 verbose stack     at async module.exports (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\lib\cli.js:78:5)
    152 verbose cwd D:\domains\volunteers\web
    153 verbose Windows_NT 10.0.22000
    154 verbose node v16.16.0
    155 verbose npm  v8.11.0
    156 error Cannot read properties of null (reading 'explain')
    157 verbose exit 1
    158 timing npm Completed in 3831ms
    159 verbose unfinished npm timer reify 1658657251816
    160 verbose unfinished npm timer reify:loadTrees 1658657251822
    161 verbose unfinished npm timer idealTree:buildDeps 1658657251833
    162 verbose unfinished npm timer idealTree:#root 1658657251833
    163 verbose code 1
    164 error A complete log of this run can be found in:
    164 error     C:\Users\Helldar\AppData\Local\npm-cache\_logs\2022-07-24T10_07_31_732Z-debug-0.log
  10. arimus commented on Jul 26, 2022

    @arimus
    Author

    This problem is super frustrating. I'm trying to get the package updated upstream, so that I no longer have a local file dependency, but that is taking a long time as well. Kind of surprised that more folks haven't been having this issue, which would give it more attention.

    Worth noting that I've been playing with pnpm recently, which does not have this issue and also has a lot of good features. However, I did find some local relative path dependencies inside my tarball dep. That forced me to adjust to regular npm repo deps and rebuild the tarball, but that was pretty easy. Generally speaking, I'd love to just use npm straight up, but I may bite the bullet and start using pnpm (with shamefully-hoist :P for the time being).

    Happy to re-test this when things are fixed though.

  11. ajibadeabd commented on Aug 1, 2022

    @ajibadeabd

    downgrade your node to 16.0, npm to 7+. this workes for me

  12. AnatuGreen commented on Aug 15, 2022

    @AnatuGreen

    Mine is this error:

    npm ERR! Cannot read properties of null (reading 'children')

    I have even uninstalled Node and reinstalled it. Same issue

  13. Zakyyy commented on Aug 15, 2022

    @Zakyyy

    @AnatuGreen Can you try to install the dependencies from a terminal that opened with Rosetta (if you're using MacBook with M1 chip)
    use node v16.16.0
    npm v8

  14. 30 remaining items

  15. self-assigned this
    on Dec 6, 2023
  16. mwe commented on Jan 26, 2024

    @mwe

    I just encountered this issue with npm 10.1.0. I didn't try downgrading to 9.0.

    This is the error

    60 verbose stack TypeError: Cannot read properties of null (reading 'package')
    In my case, I deleted `node_modules` and then tried what I was previously trying, and it worked.
    

    If this does not resolve it, also deleting the package.lock.json resolves it, it seems also to be related by a package.lock.json that is not matching the current dependency tree in relation with symlinks

  17. boshoff commented on Aug 5, 2024

    @boshoff

    Node.js: 20.12.1
    npm: 10.8.2
    OS: macOS 14.6

    $ npm cache clean --force
    (output omitted)
    $ rm -rf node_modules
    $ rm package-lock.json
    $ npm i
    npm error Cannot read properties of null (reading 'package')

    No luck, much easier to switch to pnpm.

  18. removed their assignment
    on Feb 25, 2025
  19. yinsang commented on Jul 17, 2025

    @yinsang
    rm -rf packages/*/node_modules
    

    Workspace mode may need to invoke this command.

  20. manzoorwanijk commented on Mar 28, 2026

    @manzoorwanijk
    Contributor

    Can someone please confirm if it's still an issue after npm v11.12.1?

    We recently fixed many such issues in arborist.

  21. bbrodbeck-memtime commented on May 12, 2026

    @bbrodbeck-memtime

    I have this issue with npm 11.12.1. I cannot update dependencies because of it.

  22. manzoorwanijk commented on May 12, 2026

    @manzoorwanijk
    Contributor

    Thanks everyone for the reports. This issue has been collecting cases for ~4 years and is really an umbrella for several distinct bugs that all happen to surface the same error (target.package where target is null in Node.set root). Many of the specific scenarios have been fixed in recent npm 11.x releases, including:

    I tried to reproduce the originally-reported scenarios on npm 11.12.1 (macOS) and could not trigger the crash with any of:

    • a project with a ./foo.tgz file: dep, installed twice (the original repro)
    • nested file: deps several levels deep
    • workspaces with cross-workspace deps, with and without install-strategy=linked
    • npm linked packages in a workspace

    For anyone still hitting this on 11.12.1 or newer, could you share a minimal reproduction? Specifically:

    1. The package.json (and package-lock.json if present)
    2. The node_modules/ layout right before the failing install — ls -la node_modules/ and any symlinks (find node_modules -maxdepth 3 -type l)
    3. Full npm install --verbose output (or the _logs/*-debug-0.log)
    4. OS + Node + npm versions
    5. Whether the crash happens from a clean state (no node_modules/, no package-lock.json) or only after some prior install

    Without a fresh-state repro, it's almost certainly a stale/inconsistent on-disk state where package-lock.json and node_modules have drifted (the rm -rf node_modules and rm package-lock.json workarounds that work for most people support this). If your case reproduces from a clean state on 11.12.1, that's a new bug worth a separate issue with a runnable repro.

  23. jendrikw commented on Jul 15, 2026

    @jendrikw

    I have a reproducer for this and/or #5222. This link is valid for one month: https://files.ptb-test.opndsk.de/s/r5xk6kYgYFqKtEM

    Simply extract the tgz and run npm i -D vite@8.1.4 && npm i -D @vitejs/devtools --verbose. This is my output:

    npm verbose cli /usr/bin/node /usr/bin/npm
    npm info using npm@11.16.0
    npm info using node@v24.18.0
    npm verbose title npm i @vitejs/devtools
    npm verbose argv "i" "--save-dev" "@vitejs/devtools" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:/home/USER/.npm/_logs/2026-07-15T13_01_19_938Z-
    npm verbose logfile /home/USER/.npm/_logs/2026-07-15T13_01_19_938Z-debug-0.log
    (node:822917) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
    (Use `node --trace-deprecation ...` to show where the warning was created)
    npm http fetch GET 200 https://registry.npmjs.org/@vitejs%2fdevtools 256ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/vite 80ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/@types%2fnode 61ms (cache revalidated)
    npm http cache https://registry.npmjs.org/vite 56ms (cache hit)
    npm http cache https://registry.npmjs.org/@types%2fnode 19ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/esbuild 194ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/jiti 33ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/less 27ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/sass 27ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/sass-embedded 28ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/stylus 28ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/sugarss 27ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/postcss 27ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/terser 29ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/tsx 27ms (cache revalidated)
    npm http fetch GET 200 https://registry.npmjs.org/yaml 28ms (cache revalidated)
    npm verbose stack TypeError: Cannot read properties of null (reading 'explain')
    npm verbose stack     at #explainPeerConflict (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1502:29)
    npm verbose stack     at #failPeerConflict (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1495:43)
    npm verbose stack     at #loadPeerSet (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1462:33)
    npm verbose stack     at async #buildDepStep (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:978:15)
    npm verbose stack     at async Arborist.buildIdealTree (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:178:7)
    npm verbose stack     at async Promise.all (index 1)
    npm verbose stack     at async Arborist.reify (/usr/share/nodejs/@npmcli/arborist/lib/arborist/reify.js:112:5)
    npm verbose stack     at async Install.exec (/usr/share/nodejs/npm/lib/commands/install.js:157:5)
    npm verbose stack     at async Npm.exec (/usr/share/nodejs/npm/lib/npm.js:193:9)
    npm verbose stack     at async module.exports (/usr/share/nodejs/npm/lib/cli/entry.js:67:5)
    npm error Cannot read properties of null (reading 'explain')
    npm verbose cwd /tmp/crash
    npm verbose os Linux 7.0.12+deb14.1-amd64
    npm verbose node v24.18.0
    npm verbose npm  v11.16.0
    npm verbose exit 1
    npm verbose code 1
    npm error A complete log of this run can be found in: /home/USER/.npm/_logs/2026-07-15T13_01_19_938Z-debug-0.log
    

    This is with npm and node installed via apt on a debian testing:

    $ apt list npm nodejs
    nodejs/testing,now 24.18.0+dfsg+~cs24.13.2-1 amd64 [installed,automatic]
    npm/testing,now 11.16.0+ds2-1 all [installed]
    
  24. manzoorwanijk commented on Jul 15, 2026

    @manzoorwanijk
    Contributor

    I have a reproducer for this and/or #5222. This link is valid for one month: https://files.ptb-test.opndsk.de/s/r5xk6kYgYFqKtEM

    Did you try with npm v11.18?

    Also, can you please create a GitHub repo for the code you want to share? It's hard to trust a compressed file.

  25. added a commit that references this issue on Jul 27, 2026
    74eff59
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

    Bugthing that needs fixingPriority 1high priority issueRelease 10.xRelease 8.xwork is associated with a specific npm 8 releaseRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions