cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] insufficient Information in error log when "Error: loading from incorrect packument"

Open Ognian opened this issue 3 years 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 changing from npm@7 to npm@8 and removing node_modules and package-lock.json and doing npm install I get the error: loading from incorrect packument. The detail log is:

9014 timing metavuln:cache:get:security-advisory:@ogi-it/ims:eaE6hyA4aXvB1nzbruHFZKhFQvsevpPhD+zkiChbWdhtDBDp4f+dRbcBZlk45wx0iXcEy7CF/Pu4x0DIqO4SXA== Completed in 70ms
9015 verbose stack Error: loading from incorrect packument
9015 verbose stack     at Advisory.load (/usr/local/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:89:27)
9015 verbose stack     at Calculator.[calculate] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:60:14)
9015 verbose stack     at async Promise.all (index 0)
9015 verbose stack     at async Map.[init] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:191:7)
9015 verbose stack     at async Map.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:109:7)
9016 verbose cwd /Users/ogi/Repositories/enio/enio-sites
9017 verbose Darwin 21.3.0
9018 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
9019 verbose node v17.6.0
9020 verbose npm  v8.5.3
9021 error loading from incorrect packument
9022 verbose exit 1

Expected Behavior

First I expect a definition of what a packument is in the documentation. (I searched and it is NOT defined). I asume a packument is the package.json of a module (aka package).

Second I expect the error message to contain the name of the erroneous packument. I'm not sure if the package where this happens is the one mentioned in the previous line in the detailed log (In my case: @ogi-it/ims) so please add na name of the package to the error message.

Third it should not fail or it should detailed mention what is wrong (as said before this worked with npm@7).

Steps To Reproduce

  1. npm install

Environment

  • npm: 8.5.3
  • Node.js: 17..6.0
  • OS Name: macOS 12.2.1
  • System Model Name: MBP
  • npm config:
npm config ls
npm WARN ignoring workspace config at /Users/ogi/Repositories/IMS/IMS_v2/packages/mims-test/.npmrc 
npm WARN config This command does not support workspaces.
; "user" config from /Users/ogi/.npmrc

; @ogi-it:registry = "http://localhost:4873/" ; overridden by project
//localhost:4873/:_authToken = (protected) 
//registry.npmjs.org/:_authToken = (protected) 
scripts-prepend-node-path = true 

; "project" config from /Users/ogi/Repositories/IMS/IMS_v2/.npmrc

@ogi-it:registry = "http://localhost:4873" 

; node bin location = /usr/local/bin/node
; cwd = /Users/ogi/Repositories/IMS/IMS_v2/packages/mims-test
; HOME = /Users/ogi
; Run `npm config ls -l` to show all defaults.

Ognian avatar Mar 10 '22 15:03 Ognian

I was able to resolve the issue. A detailed description is in the linked verdaccio issue. It would have saved me days of research if

  • the error message had included the package name where the problem was.
  • somewhere was sateted that you can get any packument by npx pacote packument packagename --registry=http://localhost:4873

Ognian avatar Mar 17 '22 15:03 Ognian

I am experiencing a similar issue. No error when using node 14. It looks like yet an issue related to Promises. Probably hanging do to waiting for a callback. Any thoughts or insight are appreciated.

Completed in 22ms npm verb stack Error: loading from incorrect packument npm verb stack at Advisory.load (/Users/nicktackes/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:91:27) npm verb stack at Calculator.[calculate] (/Users/nicktackes/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:60:14) npm verb stack at async Promise.all (index 0) npm verb stack at async Map.[init] (/Users/nicktackes/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:188:9) npm verb stack at async Map.run (/Users/nicktackes/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:109:7) npm verb cwd /Users/nicktackes/WebstormProjects/mm npm verb Darwin 23.4.0 npm verb node v16.20.2 npm verb npm v8.19.4

nicktackes avatar Sep 12 '24 18:09 nicktackes