jordansissel/fpm · error · NotImplementedError

#{self.class.name} does not yet support creating #{self.type

Error message

#{self.class.name} does not yet support creating #{self.type} packages

What it means

FPM::Package#output is the abstract 'write a package of this type' hook. If a format subclass only implements input (fpm can read that type but cannot create it), the base method raises NotImplementedError, e.g. 'FPM::Package::Cpan does not yet support creating cpan packages'. It fails before any file is written, as a hard stop on unsupported conversions.

Source

Thrown at lib/fpm/package.rb:251

  #
  # For instance:
  #
  # * for FPM::Package::Dir, << expects a path to a directory or files.
  # * for FPM::Package::RPM, << expects a path to an rpm.
  #
  # The idea is that you can keep pumping in new things to a package
  # for later conversion or output.
  #
  # Implementations are expected to put files relevant to the 'input' in the
  # staging_path
  def input(thing_to_input)
    raise NotImplementedError.new("#{self.class.name} does not yet support " \
                                  "reading #{self.type} packages")
  end # def input

  # Output this package to the given path.
  def output(path)
    raise NotImplementedError.new("#{self.class.name} does not yet support " \
                                  "creating #{self.type} packages")
  end # def output

  def staging_path(path=nil)
    @staging_path ||= Stud::Temporary.directory("package-#{type}-staging")

    if path.nil?
      return @staging_path
    else
      return File.join(@staging_path, path)
    end
  end # def staging_path

  def build_path(path=nil)
    @build_path ||= Stud::Temporary.directory("package-#{type}-build")

    if path.nil?
      return @build_path

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Choose an output type fpm can create (deb, rpm, apk, tar, dir, pkg, ...); for language ecosystems use their native build tool (npm pack, python -m build) instead of fpm
  2. Verify with FPM::Package.types that the target class overrides output before building automation around it
  3. In custom subclasses, implement def output(path) or raise your own clearer error

Example fix

# before
fpm -s dir -t npm ./app   # => NotImplementedError: ...creating npm packages

# after: build the npm tarball with npm itself, or emit a format fpm supports
fpm -s dir -t tar ./app
Defensive patterns

Strategy: validation

Validate before calling

require 'fpm/package'

def fpm_can_write?(type)
  klass = FPM::Package.types[type.to_s]
  !klass.nil? && klass.instance_method(:output).owner != FPM::Package
end

abort 'fpm cannot create this package type' unless fpm_can_write?('rpm')

Try / catch

begin
  pkg.output(path)
rescue NotImplementedError => e
  warn "#{pkg.class} cannot be created by fpm (#{e.message}); pick a supported -t target"
  raise
end

Prevention

When it happens

Trigger: Running 'fpm -s <src> -t cpan', '-t npm', or '-t python' (formats that implement input only), or calling pkg.output(path) on such a class; also custom subclasses missing def output.

Common situations: Trying to produce an npm/cpan/python package with fpm (those formats are input-only today); copying example commands from docs that assume a bidirectional type; custom plugin development where only the reader was written.

Related errors


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/2f1216ad9e283034. Report an issue: GitHub.