npm / npm/cli

[BUG] npm update where package.json has rel-path-to-local-pkg on windows makes bad junction

Open
#3,254 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 7.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
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:

  1. 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.
  2. 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).
  3. the real-issue; whatever is done create and validate that the resulting generated link to the local-pkg in node_modules is valid and not a BROKEN link.
Steps To Reproduce
  1. In windows
  2. With basic package.json described above
  3. Run 'npm update'
  4. 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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.