npm / npm/cli

[ENHANCEMENT] Warn on unmatched globs

Open
#7,083 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement Priority 2
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

If the file list in package.json includes a filename/glob that does not match any files, npm pack silently ignores it, even if I provide the --ddd option for maximum verbosity.

Expected Behavior

I expected some indication that npm was unable to include the file I requested in the package, preferably with a way to make that be treated as an error (i.e. make npm pack return a non-zero error code and not actually generate a .tgz file).

Steps To Reproduce
  1. touch typoable_filename so the file exists.
  2. Create package.json:
{
    "name": "test",
    "version": "1.0.0",
    "files": [
		"typeable_filename"
    ]
}

(Note typeable_filename not typoable_filename.)
3. Run npm pack --ddd.
4. See no mention of typeable_filename not being found.

Environment
  • npm: 10.2.5
  • Node.js: 20.10.0
  • OS Name: Windows 11 Enterprise Version 10.0.22631 Build 22631
  • System Model Name: Surface Book 2
  • npm config:
; "builtin" config from C:\Users\danpere\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\danpere\\AppData\\Roaming\\npm"

; "user" config from C:\Users\danpere\.npmrc

; "project" config from C:\prose\.npmrc

always-auth = true
registry = "[omitted URL]"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.10.0
; npm local prefix = C:\prose
; npm version = 10.2.5
; cwd = C:\prose
; HOME = C:\Users\danpere
; Run `npm config ls -l` to show all defaults.

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 behavior with the mentioned package.json fixture and npm pack --ddd, then trace the npm pack handling of unmatched entries in the files list. Done means unmatched filenames or globs are reported and the issue's requested option for treating them as errors has a defined, tested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.