npm / npm/cli

[BUG] Symlinks to .so files are not included in the npm package

Open
#6,744 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 9.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

I'm trying to publish a package that is a js wrapper around some executables + their depenencies (.so files). Some of the .so files, that I don't control, come as full version + symlinks, for example:

$ ls -la
libfoo.so -> libfoo.so.1
libfoo.so.1 -> libfoo.so.1.2
libfoo.so.1.2

As I understand from the documentation, npm publish doesn't include symlinks.
Currently it doesn't even follow the symlinks, so I end up with just libfoo.so.1.2 in the example above, which means missing dependencies for some of the executables (some executables depend on the fully versioned .so, others on the unversioned ones, I can't just include one). Ideally it would copy the symlinks as they are, I don't want to have 3 copies of the same libs, the package is pretty fat as it is.

Expected Behavior

Include symlinks that point inside the package when doing npm publish. If that's not possible, at least follow the symlinks and replace with their targets (will cause duplication..)

Steps To Reproduce

npm publish a package with symlinks to other files in that package.

Environment
  • npm: 9.6.7
  • Node.js: v18.17.1
  • OS Name: Ubuntu 20.04
  • System Model Name: Azure DevOps pipeline, Npm@1 task
  • npm config:
; copy and paste output from `npm config ls` here

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 npm publish on Ubuntu with a package containing versioned .so files and symlinks between them, then trace the publish packaging path that decides which filesystem entries are included. Done means symlinks pointing inside the package are preserved, or their targets are included as a documented fallback, with coverage for the reported layout.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.