npm / npm/cli

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

Open
#4,534 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Documentation Priority 2 Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failure at @npmcli/metavuln-calculator/lib/advisory.js:89 and trace its callers in lib/index.js and @npmcli/arborist/lib/audit-report.js. Reproduce with npm install using the reported environment and inspect the existing documentation for where packument terminology belongs. Done means the failure provides the affected package and more actionable detail, with the requested terminology documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.