chromaui/chromatic-cli

Unhandled promise rejection: Invalid version: "202305020808"

kanafghan opened this issue · 2 comments

Bug report

We are experiencing the following issue with Chromatic CLI which used to work fine:

yarn run v1.22.15
$ chromatic --project-token $BS_CHROMATIC_PROJECT_TOKEN -d ./dist/storybook/web-ui --exit-zero-on-changes
Unhandled promise rejection: Invalid version: "202305020808"
Done in 30.47s.

With the recent version (16.13 and 16.17) of the CLI, we are not able to use the CLI anymore due to the issue shown above. This is due to the version format in our package.json. We are using YYYYMMDDHHSS as the version format which is found invalid by the CLI. If we change the version to 1.0.0 for instance, the CLI will work normally. The workaround for us so far is to replace the version in the package.json before running the CLI 😢 .

@kanafghan Thanks for reporting this! The value being used does not conform to the node semver specification.

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#version

Regarding the error, it is triggered in two places:
readPkgUp
meow

The reason is because both libraries use normalize-package-data and that throws an error here:
https://github.com/npm/normalize-package-data/blob/096407898eb676bdf3fa6d85e2036c6676baab7b/lib/fixer.js#L205

While we could circumvent the first occurrence of the issue by passing normalize: false to readPkgUp, you can’t customize meow so it will just fail.

What's the reason(s) driving you all to use this versioning scheme instead of semver?

Hi @kanafghan! Thanks for reaching out! We are closing this issue for now. If this is still an issue for you all, let's reopen and continue the conversation.