npm / npm/cli

[BUG] `npm publish` ignores symbolic links

Open
#6,746 7 comments 10 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 have a monorepo with several packages. One of the packages is the main package. I have symlinked its README.md file to the file in the root repository.

README.md -> ../../README.md
LICENSE.MIT
cli.js
index.js
package.json

However, when I tried to publish the package, npm did not include the README file:

=== Tarball Contents ===
LICENSE.MIT
cli.js
index.js
package.json
Expected Behavior
=== Tarball Contents ===
README.md
LICENSE.MIT
cli.js
index.js
package.json
Steps To Reproduce
npm init
touch test
ln -s test README.md
npm publish --dry-run
Environment
  • npm: 9.8.1
  • Node.js: v20.2.0
  • OS Name: Arch Linux
  • npm config:
foreground-scripts = true

; node bin location = /usr/bin/node
; node version = v20.2.0
; npm local prefix = /home/matheus/dev/npm-test
; npm version = 9.8.1
; cwd = /home/matheus/dev/npm-test
; HOME = /home/matheus

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 with the shown npm init, test file, symlinked README.md, and npm publish --dry-run commands. Inspect how the package contents are assembled from package.json and the README.md symlink; done means the dry-run tarball contents include README.md as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.