Diagnosing Files Missing From a Published Package
The release went out, the tests were green, and the first bug report says "Cannot find module" or "No such file or directory". The code is fine; the artefact is incomplete. This diagnostic walks from the symptom to the rule that dropped the file, for npm tarballs and Python wheels alike.
Step 1: confirm the file is really absent
Do not trust the repository; look at what the registry served. For npm, download and list the exact published tarball:
npm pack package-a@1.4.0
tar -tzf package-a-1.4.0.tgz | sort
For Python, download the wheel without installing it and list its contents:
pip download package-a==1.4.0 --no-deps -d /tmp/pa
python -m zipfile -l /tmp/pa/package_a-1.4.0-py3-none-any.whl
If the file is present, the problem is a wrong path in your entry points rather than a missing file; skip to step 4.
Step 2: match the symptom to a likely cause
| What is missing | Most likely cause |
|---|---|
The whole dist/ or build/ folder | Build step did not run before publish, or dist is in .gitignore and there is no files field or .npmignore (npm then falls back to .gitignore) |
| One new subfolder | A files allow-list written before the folder existed |
| Type declarations only | Declarations emitted to a different directory than types points at |
| Non-Python data files in a wheel | Package data not declared for the build backend |
| A whole subpackage in a wheel | Missing __init__.py or package discovery that does not find it |
| Files present in sdist but not wheel | sdist and wheel use different inclusion rules in some backends |
Step 3: check the inclusion rules in order
npm: if package.json has a files array, only those paths (plus always-included files such as package.json, the README and the licence) ship. If it does not, npm uses .npmignore, or .gitignore when there is no .npmignore. A .npmignore in a subfolder applies there too. Check each in that order and stop at the first one that exists.
Python: check how your build backend discovers packages and data. setuptools needs package data declared (or include-package-data with files tracked or listed in MANIFEST.in); Hatchling follows your VCS ignore files and its own include and exclude settings. If you use a src/ layout, confirm the backend is pointed at it.
Step 4: check the paths that reference the file
Sometimes the file shipped but under another name. Compare every path in main, module, types and each exports condition with the tarball listing, character by character. Case matters: a path that works on a case-insensitive macOS disk fails on Linux.
Step 5: fix and republish
- Correct the rule, rebuild from a clean clone, and list the artefact again.
- Install the new artefact into an empty project and import it.
- Publish a new patch version. On npm, deprecate the broken version with a message pointing at the fix; on PyPI, consider yanking it.
- Add the listing check to CI so the next release fails before it ships.
When to ask for help: if the artefact looks right locally but differs when built in CI, compare tool versions and environment variables between the two, and ask in the build backend's issue tracker with both listings attached. Prevention lives in the tarball testing how-to and the npm pre-publish checklist; recovery steps are in recovering from a bad release.