[BUG] Switching back to npm 6 from npm 7 results in install error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Current Behavior:
I believe npm 7 is meant to be fully backwards compatible with npm 6 but I'm seeing some slight changes in my package-lock.json when I switch between the two that is causing an install error.
This is an example I'm seeing in package-lock.json under dependencies for this library:
npm 6 correct format:
"webpack-raphael": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/webpack-raphael/-/webpack-raphael-2.1.4.tgz",
"integrity": "sha1-urmFNtYox2zSQcuj0KbMdkszBD4=",
"requires": {
"eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
}
},
npm 7 format:
"node_modules/webpack-raphael": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/webpack-raphael/-/webpack-raphael-2.1.4.tgz",
"integrity": "sha1-urmFNtYox2zSQcuj0KbMdkszBD4=",
"dependencies": {
"eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
}
},
installing using npm 7 format package-lock, but in npm 6 (I'm on 6.14.0) will generate a new package-lock in npm 6 format, but changes the format of the git source for certain dependencies. i.e. "git://github.com/adobe-webplatform/eve.git#eef80ed" becomes "eve@git://github.com/adobe-webplatform/eve.git#eef80ed":
"webpack-raphael": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/webpack-raphael/-/webpack-raphael-2.1.4.tgz",
"integrity": "sha1-urmFNtYox2zSQcuj0KbMdkszBD4=",
"requires": {
"eve": "eve@git://github.com/adobe-webplatform/eve.git#eef80ed"
}
},
now if I delete my node_modules and try installing in npm 6 from this new package-lock, I get the following error:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/webpack-raphael/eve@git:/github.com/adobe-webplatform/eve.git#eef80ed" as it does not contain a package.json file.
Expected Behavior:
npm i using v6 should generate package-lock.json format into correct v6 format without having to delete the package-lock file first
Steps To Reproduce:
- start with v7 package-lock
- switch to npm 6 and
npm iwhich updates package-lock.json npm iagain using the new package-lock.json
Environment:
- OS: Ubuntu 18.04
- Node: 12.22.1
- npm: 6.14.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 with the package-lock.json examples and reproduce the reported sequence: use an npm 7 lockfile, run npm i with npm 6.14.0, then run npm i again after deleting node_modules. Trace how the git dependency is rewritten under dependencies/requires; done means npm 6 installs successfully from the generated v6 lockfile without the ENOLOCAL error.
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