Skip to content
Latchkey

npm pack: Build a Tarball to Inspect

npm pack produces the publishable tarball without uploading.

Use npm pack to catch files that should not ship (or are missing) before a real publish.

Common usage

  • npm pack - write the .tgz
  • npm pack --dry-run - list contents only
  • --json - structured file list

Example in CI

List exactly what would publish.

shell
npm pack --dry-run

In CI

Pair with the files field and .npmignore to control package contents. Run this as a release guard before npm publish.

Key takeaways

  • npm pack --dry-run previews package contents.
  • Catch missing or stray files pre-release.
  • Control contents with files/.npmignore.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →