E06262: a package must have a 'version'
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
- E06261: a package with no 'description'
- E06260: a package property of the wrong shape, or unknown
- https://ek9.io/packaging.html
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"