cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Cannot read properties of null (reading 'edgesOut') - on `npm i`

Open philSixZero opened this issue 8 months ago • 2 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

Current Behavior

After a simple npm i the CLI errors with:

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

The log shows the following:

289 silly fetch manifest happy-dom@*
290 silly packumentCache full:https://company-registry:8765/npm/hmrs-dev-internal-npm/happy-dom cache-miss
291 http cache https://company-registry:8765/npm/hmrs-dev-internal-npm/happy-dom 22ms (cache hit)
292 silly packumentCache full:https://company-registry:8765/npm/hmrs-dev-internal-npm/happy-dom set size:1135281 disposed:false
293 verbose stack TypeError: Cannot read properties of null (reading 'edgesOut')
293 verbose stack     at #loadPeerSet (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1304:38)
293 verbose stack     at async #buildDepStep (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:915:11)
293 verbose stack     at async Arborist.buildIdealTree (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:182:7)
293 verbose stack     at async Promise.all (index 1)
293 verbose stack     at async Arborist.reify (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:130:5)
293 verbose stack     at async Install.exec (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\lib\commands\install.js:149:5)
293 verbose stack     at async Npm.exec (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\lib\npm.js:208:9)
293 verbose stack     at async module.exports (C:\Users\username\AppData\Roaming\nvm\v22.14.0\node_modules\npm\lib\cli\entry.js:67:5)
294 error Cannot read properties of null (reading 'edgesOut')
295 silly unfinished npm timer reify 1745836838067
296 silly unfinished npm timer reify:loadTrees 1745836838069
297 silly unfinished npm timer idealTree:buildDeps 1745836838098
298 silly unfinished npm timer idealTree:#root 1745836838100
300 verbose os Windows_NT 10.0.26100
301 verbose node v22.14.0
302 verbose npm  v11.3.0
303 verbose exit 1
304 verbose code 1

Expected Behavior

No response

Steps To Reproduce

I'm trying to provide a reproduction package.json file.

Environment

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

philSixZero avatar Apr 28 '25 11:04 philSixZero

I was able to reproduce this issue by using this package.json

{
  "name": "peer",
  "version": "1.0.0",
  "description": "",
  "devDependencies": {
    "vitest": "^3.1.2",
    "@vitest/ui": "3.1.2"
  }
}

In this case, there is a pinned version of @vitest/ui which matches the version of the not pinned vitest

I believe I got into this scenario by using @nx/vite

edit: if you have the same issue like above, I fixed it by making sure all versions are aligned perfectly:

"devDependencies": {
    "vitest": "^3.1.2",
    "@vitest/ui": "^3.1.2"
  }

jurgensweere avatar May 06 '25 13:05 jurgensweere

able to replicate locally with json provided by @jurgensweere.

milaninfy avatar May 09 '25 20:05 milaninfy