npm / npm/cli

[BUG] fallback behaviour when hard links aren't supported

Open
#5,951 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.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
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

Running make test-only for nodejs, npm fails with EPERM, apparently from trying to create a hard link, but the file system has no support for hard links.

Log file: https://gist.github.com/jessicah/32af57e465f6f4a340f79117863f756e

Expected Behavior

Fallback behaviour to use symlinks for filesystems without hard links. Not sure whether this should be here in npm, or if a workaround should be done in nodejs itself.

Steps To Reproduce

For building nodejs on Haiku:

pkgman install devel:libcares devel:libexecinfo devel:libnghttp2 devel:libssl devel:libuv devel:libbrotli cmd:ninja
./configure --with-intl=none --dest-os=haiku --without-npm --verbose --prefix=~/config/non-packaged --shared-cares --shared-libuv --shared-nghttp2 --shared-openssl --shared-zlib --shared-brotli
make
make test-only

Example of ln failing:

ln foo bar
# ln: failed to create hard link 'bar' => 'foo': Operation not supported (EPERM)
Environment
  • npm: 8.19.2
  • Node.js: 16.18.1 + patches
  • OS Name: Haiku x86_64 (nightly)
  • System Model Name: Virtual Box
  • npm config: N/A

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 reproducing the failure with the Haiku build commands and make test-only, then inspect the log to locate the hard-link operation in npm's test path. Trace how the npm CLI handles link creation and verify the fallback behavior on a filesystem without hard-link support. Done means the test command succeeds using symlinks where hard links are unavailable.

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.