Skip to content

[BUG] npm install causes : Cannot read properties of null (reading 'explain') #5222

Closed

Description

@tamsler

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

npm install causes following error:

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

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tpa/.npm/_logs/2022-07-27T20_38_52_724Z-debug-0.log

Expected Behavior

Install packages defined in package.json

Steps To Reproduce

Download repo
cd into repo
npm install

Environment

node bin location = /usr/local/bin/node
; node version = v16.16.0
; npm local prefix = /Users/tpa/src/cb-app-www
; npm version = 8.15.0

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 Jul 27, 2022
  2. fritzy commented on Jul 27, 2022

    @fritzy

    We're going to need more steps to reproduce. What are the contents of your package.json?

  3. tamsler commented on Jul 27, 2022

    @tamsler
    Author

    Here are the dependencies:

    "dependencies": {
        "@mdi/font": "6.9.96",
        "jwt-decode": "^3.1.2",
        "pinia": "2.0.17",
        "roboto-fontface": "*",
        "vue": "3.2.37",
        "vue-router": "4.1.3",
        "vuetify": "^3.0.0-beta.5",
        "webfontloader": "1.6.28"
      },
      "devDependencies": {
        "@rushstack/eslint-patch": "^1.1.4",
        "@types/jsdom": "^16.2.14",
        "@types/node": "^16.11.41",
        "@types/webfontloader": "^1.0.0",
        "@vitejs/plugin-vue": "^2.3.3",
        "@vue/eslint-config-prettier": "^7.0.0",
        "@vue/eslint-config-typescript": "^11.0.0",
        "@vue/test-utils": "^2.0.2",
        "@vue/tsconfig": "^0.1.3",
        "cypress": "^10.3.0",
        "eslint": "^8.19.0",
        "eslint-plugin-cypress": "^2.12.1",
        "eslint-plugin-vue": "^9.2.0",
        "jsdom": "^20.0.0",
        "npm-run-all": "^4.1.5",
        "prettier": "^2.7.1",
        "start-server-and-test": "^1.14.0",
        "typescript": "~4.7.4",
        "vite": "^2.9.14",
        "vite-plugin-vuetify": "^1.0.0-alpha.12",
        "vitest": "^0.18.1",
        "vue-cli-plugin-vuetify": "~2.5.1",
        "vue-tsc": "^0.38.5"
      }
    
  4. fritzy commented on Jul 27, 2022

    @fritzy

    I'll make a quick PR to fix this edge case, but once fixed ...

    ❯ npm i                                     
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR! 
    npm ERR! Found: vuetify@"^3.0.0-beta.5" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer vuetify@"^3.0.0-beta.4" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    npm ERR! See /Users/fritzy/.npm/eresolve-report.txt for a full report.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/fritzy/.npm/_logs/2022-07-27T21_46_00_351Z-debug-0.log
    
  5. EpicWink commented on Jul 1, 2024

    @EpicWink

    I got the same error trying to install a new dependency, running npm from Apt on Ubuntu 22.04.4:

    npm i '@mikro-orm/migrations-mongodb'
    Debug logs (click to expand)
    0 verbose cli /usr/bin/node /usr/bin/npm
    1 info using npm@9.6.7
    2 info using node@v18.17.1
    3 timing npm:load:whichnode Completed in 1ms
    4 timing config:load:defaults Completed in 1ms
    5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 0ms
    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:~/src/my-project/.npmrc Completed in 0ms
    10 timing config:load:project Completed in 1ms
    11 timing config:load:file:~/.npmrc Completed in 0ms
    12 timing config:load:user Completed in 0ms
    13 timing config:load:file:/usr/etc/npmrc Completed in 0ms
    14 timing config:load:global Completed in 0ms
    15 timing config:load:setEnvs Completed in 1ms
    16 timing config:load Completed in 5ms
    17 timing npm:load:configload Completed in 5ms
    18 timing npm:load:mkdirpcache Completed in 0ms
    19 timing npm:load:mkdirplogs Completed in 0ms
    20 verbose title npm i @mikro-orm/migrations-mongodb
    21 verbose argv "i" "@mikro-orm/migrations-mongodb"
    22 timing npm:load:setTitle Completed in 1ms
    23 timing config:load:flatten Completed in 1ms
    24 timing npm:load:display Completed in 1ms
    25 verbose logfile logs-max:10 dir:~/.npm/_logs/2024-07-01T00_39_40_792Z-
    26 verbose logfile ~/.npm/_logs/2024-07-01T00_39_40_792Z-debug-0.log
    27 timing npm:load:logFile Completed in 7ms
    28 timing npm:load:timers Completed in 1ms
    29 timing npm:load:configScope Completed in 0ms
    30 timing npm:load Completed in 16ms
    31 timing arborist:ctor Completed in 0ms
    32 silly logfile start cleaning logs, removing 1 files
    33 silly logfile done cleaning log files
    34 timing idealTree:init Completed in 683ms
    35 timing idealTree:userRequests Completed in 1ms
    36 silly idealTree buildDeps
    37 silly fetch manifest @mikro-orm/migrations-mongodb@*
    38 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules/@mikro-orm/mongodb
    39 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fmigrations-mongodb 71ms (cache hit)
    40 silly fetch manifest @mikro-orm/core@^5.5.2
    41 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fcore 17ms (cache hit)
    42 silly fetch manifest @mikro-orm/core@^6.0.0
    43 silly fetch manifest @mikro-orm/better-sqlite@^5.0.0
    44 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fbetter-sqlite 403ms (cache hit)
    45 silly fetch manifest @mikro-orm/entity-generator@^5.0.0
    46 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fentity-generator 67ms (cache hit)
    47 silly fetch manifest @mikro-orm/migrations@^5.0.0
    48 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fmigrations 10ms (cache hit)
    49 silly fetch manifest @mikro-orm/seeder@^5.0.0
    50 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fseeder 9ms (cache hit)
    51 silly fetch manifest @mikro-orm/mariadb@^5.0.0
    52 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fmariadb 11ms (cache hit)
    53 silly fetch manifest @mikro-orm/migrations-mongodb@^5.0.0
    54 silly fetch manifest @mikro-orm/core@^5.0.0
    55 silly fetch manifest @mikro-orm/mongodb@^5.0.0
    56 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fmongodb 8ms (cache hit)
    57 silly fetch manifest @mikro-orm/mysql@^5.0.0
    58 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fmysql 9ms (cache hit)
    59 silly fetch manifest @mikro-orm/postgresql@^5.0.0
    60 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fpostgresql 7ms (cache hit)
    61 silly fetch manifest @mikro-orm/sqlite@^5.0.0
    62 http fetch GET 200 https://registry.npmjs.org/@mikro-orm%2fsqlite 11ms (cache hit)
    63 silly fetch manifest @mikro-orm/mongodb@^5.5.3
    64 timing idealTree Completed in 1556ms
    65 timing command:i Completed in 1560ms
    66 verbose stack TypeError: Cannot read properties of null (reading 'explain')
    66 verbose stack     at #explainPeerConflict (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1382:29)
    66 verbose stack     at #failPeerConflict (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1375:43)
    66 verbose stack     at #loadPeerSet (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1342:33)
    66 verbose stack     at async #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:917:11)
    66 verbose stack     at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:196:7)
    66 verbose stack     at async Promise.all (index 1)
    66 verbose stack     at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:159:5)
    66 verbose stack     at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:147:5)
    66 verbose stack     at async module.exports (/usr/lib/node_modules/npm/lib/cli.js:89:5)
    67 verbose cwd ~/src/my-project
    68 verbose Linux 6.5.0-41-generic
    69 verbose node v18.17.1
    70 verbose npm  v9.6.7
    71 error Cannot read properties of null (reading 'explain')
    72 verbose exit 1
    73 timing npm Completed in 1670ms
    74 verbose unfinished npm timer reify 1719794380901
    75 verbose unfinished npm timer reify:loadTrees 1719794380903
    76 verbose unfinished npm timer idealTree:buildDeps 1719794381588
    77 verbose unfinished npm timer idealTree:#root 1719794381588
    78 verbose code 1
    79 error A complete log of this run can be found in: ~/.npm/_logs/2024-07-01T00_39_40_792Z-debug-0.log
    package.json (click to expand)
    {
      "name": "@my-org/my-project",
      "version": "0.0.0",
      "license": "UNLICENSED",
      "scripts": {
        "start": "nx serve",
        "build": "nx build",
        "gen-spec": "nx gen-spec",
        "lint": "nx lint",
        "test": "nx test",
        "test:app1:scenario1:end-to-end": "ts-node --esm --project ./apps/app1/tsconfig.spec.json ./apps/app1/test/scenario1.e2e.ts"
      },
      "private": true,
      "devDependencies": {
        "@nestjs/cli": "^9.0.0",
        "@nestjs/schematics": "^9.0.0",
        "@nestjs/testing": "^9.0.0",
        "@nrwl/cli": "15.0.3",
        "@nrwl/eslint-plugin-nx": "15.0.3",
        "@nrwl/jest": "^15.0.3",
        "@nrwl/js": "15.0.3",
        "@nrwl/linter": "15.0.3",
        "@nrwl/nest": "15.0.3",
        "@nrwl/node": "15.0.3",
        "@nrwl/workspace": "15.0.3",
        "@types/express": "^4.17.13",
        "@types/jest": "28.1.1",
        "@types/node": "16.11.7",
        "@types/passport-azure-ad": "^4.3.1",
        "@types/supertest": "^2.0.11",
        "@typescript-eslint/eslint-plugin": "^5.0.0",
        "@typescript-eslint/parser": "^5.0.0",
        "aws-sdk-client-mock": "^3.0.0",
        "eslint": "^8.0.1",
        "eslint-config-prettier": "^8.3.0",
        "eslint-plugin-prettier": "^4.0.0",
        "jest": "28.1.1",
        "jest-environment-jsdom": "28.1.1",
        "jest-junit": "^15.0.0",
        "nx": "15.0.3",
        "prettier": "^2.6.2",
        "source-map-support": "^0.5.20",
        "supertest": "^6.1.3",
        "swagger-ui-express": "^4.4.0",
        "ts-jest": "28.0.5",
        "ts-loader": "^9.2.3",
        "ts-node": "10.9.1",
        "tsconfig-paths": "4.0.0",
        "typescript": "~4.8.2"
      },
      "dependencies": {
        "@aws-sdk/client-dynamodb": "^3.405.0",
        "@aws-sdk/lib-dynamodb": "^3.405.0",
        "@azure/cosmos": "^3.17.3",
        "@azure/identity": "^3.1.3",
        "@azure/keyvault-secrets": "^4.6.0",
        "@azure/service-bus": "^7.7.2",
        "@azure/storage-blob": "^12.13.0",
        "@mikro-orm/core": "^5.5.2",
        "@mikro-orm/mongodb": "^5.5.3",
        "@mikro-orm/nestjs": "^5.1.2",
        "@nestjs/common": "^9.0.0",
        "@nestjs/config": "^2.2.0",
        "@nestjs/core": "^9.0.0",
        "@nestjs/event-emitter": "^1.3.1",
        "@nestjs/mapped-types": "*",
        "@nestjs/passport": "^9.0.0",
        "@nestjs/platform-express": "^9.0.0",
        "@nestjs/swagger": "^6.0.5",
        "@opentelemetry/auto-instrumentations-node": "^0.36.6",
        "ajv": "^8.11.2",
        "ajv-formats": "^2.1.1",
        "applicationinsights": "^3.0.0-beta.4",
        "class-transformer": "^0.5.1",
        "class-validator": "^0.13.2",
        "deepmerge": "^4.3.1",
        "fast-json-patch": "^3.1.1",
        "glob-to-regexp": "^0.4.1",
        "helmet": "^6.1.5",
        "nestjs-pino": "^3.2.0",
        "obj2gltf": "^3.1.6",
        "passport": "^0.6.0",
        "passport-azure-ad": "^4.3.4",
        "reflect-metadata": "^0.1.13",
        "rimraf": "^3.0.2",
        "rxjs": "^7.0.0",
        "tslib": "^2.3.0"
      }
    }
  6. ImLunaHey commented on Aug 8, 2024

    @ImLunaHey

    just had a similar issue, i tried running npm i -D @vitest/ui.

    possibly related? vitest-dev/vitest#6111

    ➜  next-axiom git:(main) ✗ npm i  @vitest/ui
    npm error Cannot read properties of null (reading 'explain')
    npm error A complete log of this run can be found in: /Users/luna/.npm/_logs/2024-08-08T03_43_24_046Z-debug-0.log
    ➜  next-axiom git:(main) ✗ npm install -D vitest @vitest/ui
    
    added 26 packages, and changed 23 packages in 10s
    ➜  next-axiom git:(main) ✗ npm i  @vitest/ui               
    
    up to date in 7s
    ➜  next-axiom git:(main) ✗ 
    
    package.json
    {
      "name": "next-axiom",
      "description": "Send WebVitals from your Next.js project to Axiom.",
      "version": "1.4.0",
      "author": "Axiom, Inc.",
      "license": "MIT",
      "contributors": [
        "Arne Bahlo <arne@axiom.co>",
        "Islam Shehata <islam@axiom.co>"
      ],
      "engines": {
        "node": ">=18"
      },
      "main": "dist/index.js",
      "types": "dist/index.d.ts",
      "scripts": {
        "build": "tsc",
        "prepare": "npm run build",
        "format": "prettier --write src/*.ts tests/*.ts",
        "check-format": "prettier -c src/*.ts tests/*.ts",
        "test": "vitest run tests --coverage"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/axiomhq/next-axiom.git"
      },
      "keywords": [
        "web-vitals",
        "axiom",
        "observability",
        "performance",
        "nextjs"
      ],
      "bugs": {
        "url": "https://github.com/axiomhq/next-axiom/issues"
      },
      "homepage": "https://github.com/axiomhq/next-axiom#readme",
      "peerDependencies": {
        "next": ">=14.0",
        "react": ">=18.0.0"
      },
      "devDependencies": {
        "@types/node": "^20.4.2",
        "@types/react": "^18.2.15",
        "@vitest/coverage-v8": "^1.2.2",
        "prettier": "^3.0.0",
        "ts-node": "^10.9.1",
        "typescript": "^5.1.6",
        "vitest": "^1.2.2",
        "whatwg-fetch": "^3.6.2"
      },
      "dependencies": {
        "use-deep-compare": "^1.2.1"
      }
    }
    debug logs

    0 verbose cli /Users/luna/.nvm/versions/node/v20.13.1/bin/node /Users/luna/.nvm/versions/node/v20.13.1/bin/npm
    1 info using npm@10.8.1
    2 info using node@v20.13.1
    3 silly config load:file:/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/npmrc
    4 silly config load:file:/Users/luna/code/axiomhq/next-axiom/.npmrc
    5 silly config load:file:/Users/luna/.npmrc
    6 silly config load:file:/Users/luna/.nvm/versions/node/v20.13.1/etc/npmrc
    7 verbose title npm i @vitest/ui
    8 verbose argv "i" "--save-dev" "@vitest/ui"
    9 verbose logfile logs-max:10 dir:/Users/luna/.npm/_logs/2024-08-08T03_39_42_409Z-
    10 verbose logfile /Users/luna/.npm/_logs/2024-08-08T03_39_42_409Z-debug-0.log
    11 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
    12 silly logfile start cleaning logs, removing 1 files
    13 silly logfile done cleaning log files
    14 silly idealTree buildDeps
    15 silly fetch manifest @vitest/ui@*
    16 silly packumentCache full:https://registry.npmjs.org/@vitest%2fui cache-miss
    17 http fetch GET 200 https://registry.npmjs.org/@vitest%2fui 19ms (cache hit)
    18 silly packumentCache full:https://registry.npmjs.org/@vitest%2fui set size:890824 disposed:false
    19 silly fetch manifest vitest@^1.2.2
    20 silly packumentCache full:https://registry.npmjs.org/vitest cache-miss
    21 http fetch GET 200 https://registry.npmjs.org/vitest 4ms (cache hit)
    22 silly packumentCache full:https://registry.npmjs.org/vitest set size:1619482 disposed:false
    23 silly fetch manifest vitest@2.0.5
    24 silly packumentCache full:https://registry.npmjs.org/vitest cache-miss
    25 http fetch GET 200 https://registry.npmjs.org/vitest 4ms (cache hit)
    26 silly packumentCache full:https://registry.npmjs.org/vitest set size:1619482 disposed:false
    27 silly fetch manifest @edge-runtime/vm@*
    28 silly packumentCache full:https://registry.npmjs.org/@edge-runtime%2fvm cache-miss
    29 http fetch GET 200 https://registry.npmjs.org/@edge-runtime%2fvm 4ms (cache hit)
    30 silly packumentCache full:https://registry.npmjs.org/@edge-runtime%2fvm set size:261821 disposed:false
    31 silly fetch manifest @types/node@^20.4.2
    32 silly packumentCache full:https://registry.npmjs.org/@types%2fnode cache-miss
    33 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 9ms (cache hit)
    34 silly packumentCache full:https://registry.npmjs.org/@types%2fnode set size:8912648 disposed:false
    35 silly fetch manifest @vitest/browser@1.6.0
    36 silly packumentCache full:https://registry.npmjs.org/@vitest%2fbrowser cache-miss
    37 http fetch GET 200 https://registry.npmjs.org/@vitest%2fbrowser 6ms (cache hit)
    38 silly packumentCache full:https://registry.npmjs.org/@vitest%2fbrowser set size:381736 disposed:false
    39 silly fetch manifest playwright@*
    40 silly packumentCache full:https://registry.npmjs.org/playwright cache-miss
    41 http fetch GET 200 https://registry.npmjs.org/playwright 13ms (cache hit)
    42 silly packumentCache full:https://registry.npmjs.org/playwright set size:12969141 disposed:false
    43 silly fetch manifest webdriverio@*
    44 silly packumentCache full:https://registry.npmjs.org/webdriverio cache-miss
    45 http fetch GET 200 https://registry.npmjs.org/webdriverio 7ms (cache hit)
    46 silly packumentCache full:https://registry.npmjs.org/webdriverio set size:2793876 disposed:false
    47 silly fetch manifest devtools@^8.14.0
    48 silly packumentCache full:https://registry.npmjs.org/devtools cache-miss
    49 http fetch GET 200 https://registry.npmjs.org/devtools 4ms (cache hit)
    50 silly packumentCache full:https://registry.npmjs.org/devtools set size:1146504 disposed:false
    51 silly fetch manifest @vitest/ui@1.6.0
    52 silly packumentCache full:https://registry.npmjs.org/@vitest%2fui cache-hit
    53 silly fetch manifest vitest@1.6.0
    54 silly packumentCache full:https://registry.npmjs.org/vitest cache-miss
    55 http fetch GET 200 https://registry.npmjs.org/vitest 3ms (cache hit)
    56 silly packumentCache full:https://registry.npmjs.org/vitest set size:1619482 disposed:false
    57 silly fetch manifest @types/node@^18.0.0 || >=20.0.0
    58 silly packumentCache full:https://registry.npmjs.org/@types%2fnode cache-miss
    59 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 8ms (cache hit)
    60 silly packumentCache full:https://registry.npmjs.org/@types%2fnode set size:8912648 disposed:false
    61 silly fetch manifest happy-dom@*
    62 silly packumentCache full:https://registry.npmjs.org/happy-dom cache-miss
    63 http fetch GET 200 https://registry.npmjs.org/happy-dom 9ms (cache hit)
    64 silly packumentCache full:https://registry.npmjs.org/happy-dom set size:1930571 disposed:false
    65 silly fetch manifest jsdom@*
    66 silly packumentCache full:https://registry.npmjs.org/jsdom cache-miss
    67 http fetch GET 200 https://registry.npmjs.org/jsdom 3ms (cache hit)
    68 silly packumentCache full:https://registry.npmjs.org/jsdom set size:976108 disposed:false
    69 silly fetch manifest canvas@^2.11.2
    70 silly packumentCache full:https://registry.npmjs.org/canvas cache-miss
    71 http fetch GET 200 https://registry.npmjs.org/canvas 3ms (cache hit)
    72 silly packumentCache full:https://registry.npmjs.org/canvas set size:637051 disposed:false
    73 verbose stack TypeError: Cannot read properties of null (reading 'explain')
    73 verbose stack at #explainPeerConflict (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1366:29)
    73 verbose stack at #failPeerConflict (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1359:43)
    73 verbose stack at #loadPeerSet (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1326:33)
    73 verbose stack at async #buildDepStep (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:901:11)
    73 verbose stack at async Arborist.buildIdealTree (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
    73 verbose stack at async Promise.all (index 1)
    73 verbose stack at async Arborist.reify (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
    73 verbose stack at async Install.exec (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/lib/commands/install.js:150:5)
    73 verbose stack at async Npm.exec (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/lib/npm.js:207:9)
    73 verbose stack at async module.exports (/Users/luna/.nvm/versions/node/v20.13.1/lib/node_modules/npm/lib/cli/entry.js:74:5)
    74 error Cannot read properties of null (reading 'explain')
    75 silly unfinished npm timer reify 1723088382531
    76 silly unfinished npm timer reify:loadTrees 1723088382534
    77 silly unfinished npm timer idealTree:buildDeps 1723088382563
    78 silly unfinished npm timer idealTree:#root 1723088382563
    79 verbose cwd /Users/luna/code/axiomhq/next-axiom
    80 verbose os Darwin 23.5.0
    81 verbose node v20.13.1
    82 verbose npm v10.8.1
    83 verbose exit 1
    84 verbose code 1
    85 error A complete log of this run can be found in: /Users/luna/.npm/_logs/2024-08-08T03_39_42_409Z-debug-0.log

  7. nunoferna commented on Jan 26, 2025

    @nunoferna

    SOLUTION:
    I just figured out the solution for this problem. While I was checking some versions, I saw that vitest had a new recent version as well as @vitest/coverage-v8and @vitest/ui which I updated to version ^3.0.4. With this I find that is NOT a npm cli issue, it is mainly a deprecated/bad-configured library version.

    PROBLEM:
    Hi, I am facing the same error, I run the --verbose to get more information, but I am can't solve. I am using docker, the versions there specified ( I tried lower versions but it gets me the same error ). This is only getting me error on Ubuntu systems, on MacOS is running fine:

    npm verbose cli /usr/local/bin/node /usr/local/bin/npm
    npm info using npm@11.0.0
    npm info using node@v23.6.1
    npm verbose title npm I
    npm verbose argv "i" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:/root/.npm/_logs/2025-01-26T00_59_47_954Z-
    npm verbose logfile /root/.npm/_logs/2025-01-26T00_59_47_954Z-debug-0.log
    npm http fetch GET 200 https://registry.npmjs.org/npm 253ms
    npm http fetch GET 200 https://registry.npmjs.org/@vis.gl%2freact-google-maps 1503ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/react 194ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/react-dom 204ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/react-icons 93ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/react-router-dom 99ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/vitest-browser-react 544ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/@types%2freact 179ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/@types%2freact-dom 145ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/@vitest%2fbrowser 323ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/playwright 432ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/vitest 101ms (cache miss)
    npm http cache https://registry.npmjs.org/vitest 16ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/@edge-runtime%2fvm 302ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/@types%2fnode 348ms (cache miss)
    npm http cache https://registry.npmjs.org/@vitest%2fbrowser 6ms (cache hit)
    npm http cache https://registry.npmjs.org/playwright 14ms (cache hit)
    npm http cache https://registry.npmjs.org/vitest 5ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/@vitest%2fui 203ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/happy-dom 675ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/jsdom 91ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/canvas 92ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/webdriverio 116ms (cache miss)
    npm http fetch GET 200 https://registry.npmjs.org/puppeteer-core 98ms (cache miss)
    npm http cache https://registry.npmjs.org/@vitest%2fui 3ms (cache hit)
    npm verbose stack TypeError: Cannot read properties of null (reading 'explain')
    npm verbose stack at #explainPeerConflict (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1369:29)
    npm verbose stack at #failPeerConflict (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1362:43)
    npm verbose stack at #loadPeerSet (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1329:33)
    npm verbose stack at async #loadPeerSet (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1297:11)
    npm verbose stack at async #buildDepStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:11)
    npm verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
    npm verbose stack at async Promise.all (index 1)
    npm verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
    npm verbose stack at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
    npm verbose stack at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
    npm error Cannot read properties of null (reading 'explain')
    npm verbose cwd /app
    npm verbose os Linux 6.10.14-linuxkit
    npm verbose node v23.6.1
    npm verbose npm v11.0.0
    npm verbose exit 1
    npm verbose code 1
    npm error A complete log of this run can be found in: /root/.npm/_logs/2025-01-26T00_59_47_954Z-debug-0.log
    

    here is my package.json:

    {
      "name": "frontend",
      "private": true,
      "version": "0.3.0",
      "type": "module",
      "scripts": {
        "dev": "vite",
        "build": "tsc -b && vite build",
        "clean": "rm -rf dist lib node_modules",
        "lint": "eslint .",
        "preview": "vite preview",
        "test": "vitest",
        "coverage": "vitest --coverage",
        "style-check": "prettier --check 'src/**/*.{ts,tsx,js,jsx,json}'"
      },
      "dependencies": {
        "@vis.gl/react-google-maps": "^1.4.0",
        "react": "^19.0.0",
        "react-dom": "^19.0.0",
        "react-icons": "^5.4.0",
        "react-router-dom": "^7.1.1",
        "vitest-browser-react": "^0.0.4"
      },
      "devDependencies": {
        "@eslint/js": "^9.17.0",
        "@types/react": "^19.0.2",
        "@types/react-dom": "^19.0.2",
        "@vitejs/plugin-react": "^4.3.3",
        "@vitest/coverage-v8": "^2.1.8",
        "@vitest/ui": "^2.1.8",
        "autoprefixer": "^10.4.20",
        "daisyui": "^4.12.23",
        "eslint": "^9.17.0",
        "eslint-config-prettier": "^10.0.1",
        "eslint-plugin-prettier": "^5.2.1",
        "eslint-plugin-react-hooks": "^5.1.0",
        "eslint-plugin-react-refresh": "^0.4.13",
        "globals": "^15.14.0",
        "playwright": "^1.49.1",
        "postcss": "^8.4.49",
        "prettier": "3.4.2",
        "tailwindcss": "^3.4.17",
        "typescript": "~5.7.2",
        "typescript-eslint": "^8.18.2",
        "vite": "^6.0.6",
        "vitest": "^2.1.8"
      }
    }
    
  8. nzakas commented on Jan 28, 2025

    @nzakas

    I also ran into this problem. The long and short of it is that npm is finding a peer dependency conflict, but due to an error in npm, it's not showing a helpful message.

    In my case, the solution was to delete node_modules and npm install from scratch. It looked like I had some out-of-date dependencies in my node_modules and npm wasn't updating them as part of a dirty npm install.

    Hope this helps!

  9. manzoorwanijk commented on Jul 15, 2026

    @manzoorwanijk
    Contributor

    Steps To Reproduce

    vite@8.1.4 declares an optional peer on @vitejs/devtools (^0.3.0). @vitejs/devtools peer-depends on vite@*. Installing vite first, then adding devtools, makes arborist pick the newest devtools (0.4.1), which violates vite's optional peer range, attempt a mid-resolution back-off to 0.3.4, and then crash while explaining the resulting phantom conflict.

    rm -rf /tmp/npm-5222-repro
    mkdir -p /tmp/npm-5222-repro
    cd /tmp/npm-5222-repro
    
    cat > package.json << 'EOF'
    {
      "name": "npm-5222-repro",
      "version": "1.0.0",
      "private": true
    }
    EOF
    
    # 1) install a package whose OPTIONAL peer is a plugin range (^0.3.0)
    npm install --save-dev vite@8.1.4
    
    # 2) add the plugin; newest (0.4.1) violates vite's optional peer, older (0.3.4) satisfies it
    #    (versions pinned for determinism; `npm i -D @vitejs/devtools` reproduces it the same way)
    npm install --save-dev '@vitejs/devtools@0.3.4 || 0.4.1'

    Result (npm 11.18.0, Node 24):

    npm error Cannot read properties of null (reading 'explain')
    npm verbose stack TypeError: Cannot read properties of null (reading 'explain')
    npm verbose stack     at #explainPeerConflict (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js)
    npm verbose stack     at #failPeerConflict (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js)
    npm verbose stack     at #loadPeerSet (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js)
    

    Expected: a proper ERESOLVE report (or a clean back-off to @vitejs/devtools@0.3.4), not a TypeError.

    Cleanup

    rm -rf /tmp/npm-5222-repro
  10. 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 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions