jordansissel/fpm · error · FPM::InvalidPackageConfiguration
Could not find package metadata. Checked for META.json, META
Error message
Could not find package metadata. Checked for META.json, META.yml, and MetaCPAN API data
What it means
The cpan input builds metadata from two sources: a MetaCPAN API query for the module, and local META.json / META.yml / MYMETA.yml if present in the module directory. If both yield nothing (the merged hash is empty), FPM::InvalidPackageConfiguration is raised — fpm has no name or version to build from.
Source
Thrown at lib/fpm/package/cpan.rb:92
local_metadata = JSON.parse(File.read(File.join(moduledir, ("META.json"))))
elsif File.exist?(File.join(moduledir, ("META.yml")))
require "yaml"
local_metadata = YAML.load_file(File.join(moduledir, ("META.yml")))
elsif File.exist?(File.join(moduledir, "MYMETA.json"))
local_metadata = JSON.parse(File.read(File.join(moduledir, ("MYMETA.json"))))
elsif File.exist?(File.join(moduledir, ("MYMETA.yml")))
require "yaml"
local_metadata = YAML.load_file(File.join(moduledir, ("MYMETA.yml")))
end
# Merge the MetaCPAN query result and the metadata pulled from the local
# META file(s). The local data overwrites the query data for all keys the
# two hashes have in common. Merge with an empty hash if there was no
# local META file.
metadata = result.merge(local_metadata || {})
if metadata.empty?
raise FPM::InvalidPackageConfiguration,
"Could not find package metadata. Checked for META.json, META.yml, and MetaCPAN API data"
end
self.version = metadata["version"]
self.description = metadata["abstract"]
self.license = case metadata["license"]
when Array; metadata["license"].first
when nil; "unknown"
else; metadata["license"]
end
unless metadata["release"].nil?
dist_name, _, dist_version = metadata["release"].rpartition('-')
logger.info("Setting package name from 'distribution'",
:distribution => dist_name)
self.name = fix_name(dist_name)
self.provides = search_provided_modules(dist_name, dist_version)View on GitHub (pinned to b6d77ba72a)
Solutions
- Run 'perl Makefile.PL' (or Build.PL) in the module dir to generate MYMETA, then pass the directory path to fpm
- Verify MetaCPAN reachability: curl https://fastapi.metacpan.org/v1/module/Your::Module
- For private modules, fall back to -s dir with explicit --name/--version, or vendor a META.yml into the dist
- Double-check the module name spelling and that it exists on CPAN
Example fix
# before (offline, bare source dir) fpm -s cpan -t deb My::Internal::Module # after: generate local metadata, package from the directory (cd My-Internal-Module && perl Makefile.PL) fpm -s cpan -t deb ./My-Internal-Module
Defensive patterns
Strategy: try-catch
Validate before calling
meta_sources = %w[META.json META.yml MYMETA.yml]
has_local_meta = meta_sources.any? { |m| File.exist?(File.join(module_dir, m)) }
net_ok = system('curl', '-fsS', 'https://fastapi.metacpan.org/v1/module/Your::Module', out: File::NULL, err: File::NULL)
abort 'no CPAN metadata source available (offline and no META files)' unless has_local_meta || net_ok Try / catch
begin
pkg = FPM::Package::Cpan.new
pkg.input('Some::Module')
rescue FPM::InvalidPackageConfiguration => e
warn "no CPAN metadata found (#{e.message}); check network or add META.yml/MYMETA.yml"
pkg.cleanup
end Prevention
- Ship META.json/META.yml inside private Perl dists, or run perl Makefile.PL first to generate MYMETA
- Verify MetaCPAN reachability from the build host before -s cpan runs
- For air-gapped builds, vendor the module directory with metadata and package from the local path
When it happens
Trigger: Running 'fpm -s cpan -t deb Some::Module' offline or behind a blocking proxy (MetaCPAN query returns nothing) while the module directory has no META files; a typo'd module name not found on MetaCPAN; private/internal Perl distributions never published to CPAN.
Common situations: Air-gapped or firewalled build agents; corporate proxies blocking fastapi.metacpan.org; packaging internal modules; pointing -s cpan at a bare source dir where perl Makefile.PL was never run (no MYMETA generated).
Related errors
- Unexpected CPAN 'author' field type: #{metadata["author"].cl
- I don't know how to build #{name}. No Makefile.PL nor Build.
- metacpan release query failed
- metacpan query failed
- #{self.class.name} does not yet support reading #{self.type}
AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21).
Data as JSON: /api/errors/211d21e256eb365b.
Report an issue: GitHub.