npm / npm/cli

[BUG] `bundledDependencies` does not bundle relevant executables

Open
#2,491 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Current Behavior:

Bundled dependencies do not export executables when packing.

Expected Behavior:

npm pack output should include scripts under .bin to launch any executables provided by the bundled depdency.

Steps To Reproduce:
  1. Install any dependency that exposes an executable, e.g. lws.
  2. Include this dependency in bundledDependencies
  3. npm pack
  4. The resulting artifact includes the bundledDependency under node_modules, but does not create a .bin directory at all, and so the depdency's executable(s) will not be available.
Environment:
  • WIn10 20H2
  • Node: 14.15.4
  • npm: 6.14.10
Notes

I see from https://github.com/npm/cli/issues/1689 that bundledDependencies does not currently do special handling of the dep's package.json, such as looking at the files field. It's probably impractical / undesirable to process the whole bin field from package.json during pack, but at least it would make sense to check the existing node_modules/.bin for scripts that exactly match the package name and include those in the output.

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 report with npm pack, then inspect package.json, node_modules/.bin, and the packed artifact. Compare the behavior with the special handling discussed in issue 1689. Done means a bundled dependency's matching executable is available under .bin in the npm pack output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
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.