[BUG] npm update where package.json has rel-path-to-local-pkg on windows makes bad junction
Nobody has claimed this yet.
- 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
Current Behavior
[BUG] npm update where package.json has rel-path-to-local-pkg on Windows makes bad junction in referencing packages node_modules directory.
"dependencies": {
"efekt": "file:N:/local/ws/AfBuild-ws/.projects/cordova/.af/kits/efekt",
},
VERSUS
"dependencies": {
"efekt": "file:../../kits/efekt",
},
On Windows w/v7.5.1 creates a junction (not a symlink) and the path it computes is invalid (incorrect). One can manually correct it, but any repeat of the npm update cmd will replace with a new BAD junction entry.
Error: ELOOP: too many symbolic links encountered, stat
errno: -4067,
syscall: 'stat',
code: 'ELOOP',
Expected Behavior
The expected behaviors would be:
- use a Windows symlink reparse-point, not a junction reparse-point (longer explanation of the distinctions on Windows and their significance can be provided if necessary). If you don't want it traced as link, use a distinguished file-attribute to indicate that.
- use a relative path (not an absolute path) in the link; again, explanations can be provided. Always resolve true-paths (flatten paths before processing links).
- the real-issue; whatever is done create and validate that the resulting generated link to the local-pkg in
node_modulesis valid and not a BROKEN link.
Steps To Reproduce
- In windows
- With basic
package.jsondescribed above - Run 'npm update'
- You'll find a BROKEN/BAD junction was created in
npm_modules.
Environment
- OS: Windows 10 PRO
- Node: 15.8.0
- npm: 7.5.1
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
Reproduce the issue on Windows 10 with the package.json dependency using a relative file path, then run npm update and inspect the generated entry in the referencing package's node_modules directory. Trace the link creation and path resolution behavior; done means the local package link is valid after npm update and does not produce the reported ELOOP error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100