[BUG] npm7 does not create transitive node_module folders for dependencies referenced via file:/
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
I've searched release notes, however I was unable to see if this was an intended breaking change.
Current Behavior:
When referencing a dependency via file:../path/to/dep, npm@7.0.9 does not install or create the transitive node_modules folder for dep
Expected Behavior:
npm@6.12.0 will create and install the node_modules folder for the referenced dependency
Steps To Reproduce:
mkdir a b
// create the package.json files with dependencies
cat << EOF > b/package.json
{
"name": "b",
"version": "1.0.0",
"dependencies": {
"lodash": "^4.17.20"
}
}
EOF
cat << EOF > a/package.json
{
"name": "a",
"version": "1.0.0",
"dependencies": {
"b": "file:../b"
}
}
EOF
// create a lock file for b
cd b
npm install --package-lock-only
// install for a, creating lock file and node_modules
cd ../a
npm install
a/node_modules will contain the symlink to ../../b, but with no node_modules for b
Environment:
npm@7:
- OS: MacOS 10.14.4
- Node: v15.0.1
- npm: v7.0.9
npm@6:
- OS: MacOS 10.14.4
- Node: v12.13.0
- npm: v6.12.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided reproduction with npm@7.0.9 and compare the resulting a/node_modules layout with npm@6.12.0. Confirm whether the file:../b symlink lacks b's transitive node_modules directory, then trace npm CLI's handling of file dependencies and add a regression test covering the expected installation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100