npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.54k stars 3.2k forks source link

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

Open tamsler opened 2 years ago

tamsler commented 2 years ago

Is there an existing issue for this?

This issue exists in the latest npm version

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

fritzy commented 2 years ago

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

tamsler commented 2 years ago

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"
  }
fritzy commented 2 years ago

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
EpicWink commented 5 months ago

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) ```javascript 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) ```json { "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" } } ```
ImLunaHey commented 3 months ago

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

possibly related? https://github.com/vitest-dev/vitest/issues/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 ```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 ", "Islam Shehata " ], "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