E06262: a package must have a 'version'

Category: E06xxx Type hierarchy checks · Reported in phase: SYMBOL_DEFINITION · Classification: PACKAGE_VERSION_MISSING · All error codes

What went wrong

A 'defines package' block has no 'version'. Every package must have one: it is what the version commands ('ek9 -IV', '-SV', '-SF') change, what a dependency names, and what a published package is known by. The compiler, the language server and every tool report it (the message starts "In '<module>' package:").

A 'version' that is there but not a VersionNumber literal (1.0.0-0) is E06260, not this.

How to fix it

Add a 'version' to the package block, as a VersionNumber literal - major.minor.patch-build: 'version <- 1.0.0-0'.

The [EXAMPLE] section below shows a package with no version, and the same package with one.

Common causes

  • A package block written only to name the package or list its files
  • A package that is not meant to be published - it still has a version (publishing is decided by publicAccess, license and capabilities)
  • A misspelt property name ('verison' - that one is E06260, and the version is still missing)

See also

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E06262: a package must have a 'version'

#!ek9
defines module error.e06262.bad

  defines package
    description <- "A library"

Fixed: Give the package a version

#!ek9
defines module error.e06262.good

  defines package
    version <- 1.0.0-0
    description <- "A library"