npm / npm/documentation

`packages` keys do not appear to be true paths

Open
#645 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

content
Dominant language
MDX
Stars
711
Forks
4.2k
Avg merge
4d 16h
Merged PRs (30d)
3

Description

Documentation for the keys of the packages property in package-lock.json files describes them as "relative paths from the root project folder". This does not appear to be entirely true.

Consider the following package.json:

package.json:

{
  "name": "my-project",
  "dependencies": {
    "@scope/package-a": "^1.0.0",
  }
}

Assume also that "@scope/package-a" has a dependency on a package called "@scope.package-b". When npm installs dependencies, the project directory structure looks like this:

my-project
├─node_modules
│ └─@scope
│   ├─package-a
│   └─package-b
├─package.json
└─package-lock.json

However, package-lock.json has the following entry under packages:

"node_modules/@scope/package-a/node_modules/@scope/package-b": {
  "version": "1.0.0",
  ...
},

Notice the path does not actually exist in the directory.

Documentation should be clear about whether this is expected or whether the relative paths, as described, are true paths.

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 by locating the documentation for the packages property in package-lock.json and reproduce the shown scoped-dependency layout with npm. Done when the docs explicitly explain whether package keys are logical dependency locations rather than filesystem paths, including the nested scoped-package example.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.