You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the npm spec, it's fine to omit the version field in package.json:
If you don't plan to publish your package, the name and version fields are optional
Omitting the version field is common for leaf packages that won't ever be published, such as "apps" in a monorepo. IMO this change (introduced by v12) feels like a regression.
Here's a simple repro. The following package.json declares a private package ("app"):
$ npm run repro
> repro
> syncpack list-mismatches
= Default Version Group ========================================================
✘ my-express-app PACKAGE_JSON_HAS_NO_VERSION → ??? package.json > version [MissingLocalVersion]
package.json does not have a .version property which is exact semver
1 ✓ already valid
1 ! can be fixed manually using syncpack prompt
Suggested Solution
Relax the policy such that leaf packages (that no one depends on) can omit the version field
Help Needed
The text was updated successfully, but these errors were encountered:
I would stay on v11 for now if this is an issue – or add "version": "0.0.0" to the package.
JamieMason
changed the title
Since v12, every package.json must include a version field
fix(local): allow missing .version if not depended on
Dec 29, 2023
Description
According to the npm spec, it's fine to omit the
version
field in package.json:Omitting the
version
field is common for leaf packages that won't ever be published, such as "apps" in a monorepo. IMO this change (introduced by v12) feels like a regression.Here's a simple repro. The following
package.json
declares a private package ("app"):Suggested Solution
Relax the policy such that leaf packages (that no one depends on) can omit the
version
fieldHelp Needed
The text was updated successfully, but these errors were encountered: