Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error while parsing cli flags #235

Closed
danhorvath opened this issue Jan 7, 2021 · 14 comments
Closed

Error while parsing cli flags #235

danhorvath opened this issue Jan 7, 2021 · 14 comments

Comments

@danhorvath
Copy link

Hey!

Since today all our chromatic builds have been failing with the following error:


$ npx chromatic --project-token XXX
npx: installed 321 in 8.41s
Unhandled promise rejection: Flag keys may not contain '-': project-token, app-code, build-script-name, output-dir, storybook-build-dir, allow-console-errors, auto-accept-changes, exit-once-uploaded, exit-zero-on-changes, ignore-last-build-on-branch, patch-build, preserve-missing, junit-report, do-not-start, script-name, storybook-port, storybook-url, storybook-https, storybook-cert, storybook-key, storybook-ca

Based on the stack trace this issue is probably related to a new release in the meow dependency https://github.com/sindresorhus/meow/releases/tag/v8.1.1

@MichaelPeter
Copy link

MichaelPeter commented Jan 7, 2021

One of my colleagues had the same Problem, but now I tried it on my pc (npm chromatic 5.50) and it worked.

Could this have been a server issue? Is it still occuring for others?

For us it was the inital build

@Greg-G23
Copy link

Greg-G23 commented Jan 7, 2021

@MichaelPeter Working for me now too, thanks for the heads up

@MichaelPeter
Copy link

MichaelPeter commented Jan 7, 2021

Edit: For me the error is happen now again - also just updated to the latest storybook version 6.1.11:

Unhandled promise rejection: Flag keys may not contain '-': project-token, app-code, build-script-name, output-dir, storybook-build-dir, allow-console-errors, auto-accept-changes, exit-once-uploaded, exit-zero-on-changes, ignore-last-build-on-branch, patch-build, preserve-missing, junit-report, do-not-start, script-name, storybook-port, storybook-url, storybook-https, storybook-cert, storybook-key, storybook-ca
Error: Flag keys may not contain '-': project-token, app-code, build-script-name, output-dir, storybook-build-dir, allow-console-errors, auto-accept-changes, exit-once-uploaded, exit-zero-on-changes, ignore-last-build-on-branch, patch-build, preserve-missing, junit-report, do-not-start, script-name, storybook-port, storybook-url, storybook-https, storybook-cert, storybook-key, storybook-ca
at validateOptions (XXX\node_modules\chromatic\node_modules\meow\index.js:61:9)
at meow (XXX\node_modules\chromatic\node_modules\meow\index.js:136:2)
at parseArgs (XXX\node_modules\chromatic\bin\lib\parseArgs.js:4:39)

Edit:
@danhorvath: As you wrote in your issue the problem seems to be meow package in the chromatic node_modules

meow\index.js:61:9:

	const invalidFlags = Object.keys(flags).filter(flagKey => flagKey.includes('-') && flagKey !== '--');
	if (invalidFlags.length > 0) {
		throw new Error(`Flag keys may not contain '-': ${invalidFlags.join(', ')}`);
	}

Also as you said a downgrade is maybe required.
https://github.com/sindresorhus/meow/releases

Edit 2:
Chromatic project.json specifies just minimum version 8.0.0
"meow": "^8.0.0",

But my version in chromatic/npm_modules is 8.1.1.
Downgrading NPM to meow 8.1.0 could be a temporary workarround?

TL;DR Npm install breaks your chromatic...

@MichaelPeter
Copy link

As seen here, meow.js released a version 8.1.2 without the change made a major version 9 with the breaking change sindresorhus/meow#173.

So deleting the 8.1.1 package in chromatic and reinstalling 8.1.2 fixes the problem.

thank you mr @sindresorhus

@danhorvath
Copy link
Author

Thanks for updating us @MichaelPeter! Couldn't find the 8.1.2 release on https://github.com/sindresorhus/meow/releases but I see that it's there on npm. With that the issue is resolved, I'm closing the ticket.

@bodograumann
Copy link

Can we please reopen this?
The problem is back, because of the recent dependency update that included meow 9

@danhorvath
Copy link
Author

@bodograumann we don't experience this issue so I suggest that you open a new ticket - maybe it's related to your specific setup.

@bodograumann
Copy link

The problem was reintroduced in 5.6.2, maybe you have not updated yet. Otherwise I'd be happy to create a new ticket.

@TheSonOfThomp
Copy link

Just upgraded to 5.6.2, and still seeing this issue

@danhorvath
Copy link
Author

Guys please open a new ticket with this. We don't experience this problem and so I'd rather not manage this ticket since I won't be able to provide further info to the maintainers.

@danhorvath
Copy link
Author

It seems one was already opened #281

@bodograumann
Copy link

Sorry, I did not intent to bother you with this.
I feel it is usually a good thing to keep all information for a specific issue in one place.
That way people can find it more easily.

Of course if this causes problems for you, I will respect your decision.

@tmeasday
Copy link
Member

@bodograumann / @TheSonOfThomp are you seeing the issue: "Flag keys may not contain '-': " or the "The flag --projectToken can only be set once" issue?

@TheSonOfThomp
Copy link

TheSonOfThomp commented Feb 17, 2021

@tmeasday Im seeing the "Flag keys may not contain '-': " issue on 5.6.2. Just saw the fix should be up in 5.6.3

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants