Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Wrong JSON structure in ...\node_modules\yargs\locales\cs.json during a migration process #12380

Closed
mlc-mlapis opened this issue Oct 3, 2022 · 9 comments

Comments

@mlc-mlapis
Copy link

mlc-mlapis commented Oct 3, 2022

Current Behavior

Running the nx migrate latest (or any other with a concrete version) command leads to a runtime error (Windows 10 with Czech locale set). I already created a PR in the yargs package for it: yargs/yargs#2242

SyntaxError: syntax error in C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\locales\cs.json
    at JSON.parse (<anonymous>)
    at Y18N._readLocaleFile (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\y18n\build\index.cjs:141:37)
    at Y18N.__ (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\y18n\build\index.cjs:30:18)
    at Object.P.n.getPositionalGroupName (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\build\index.cjs:1:14322)
    at Xt.positional (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\build\index.cjs:1:41613)
    at withMigrationOptions (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\nx\src\command-line\nx-commands.js:644:10)
    at C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\nx\src\command-line\nx-commands.js:247:64
    at M.applyBuilderUpdateUsageAndParse (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\build\index.cjs:1:7384)
    at M.runCommand (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\build\index.cjs:1:7078)
    at Xt.[runYargsParserAndExecuteCommands] (C:\Temp\tmp-26860-zE27hc4eyGFz\node_modules\yargs\build\index.cjs:1:57900)

When checking the file cs.json, it's clear that there is a mistake in the JSON structure on line 18 ("other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s",), where an extra comma is placed at the end of the line. Other locale files (like en.json, ...) don't have this mistake.

Expected Behavior

Valid JSON structure of the cs.json file.

@mlc-mlapis mlc-mlapis changed the title Wrong JSON structure in ...\node_modules\yargs\locales\cs.json during migration process Wrong JSON structure in ...\node_modules\yargs\locales\cs.json during a migration process Oct 3, 2022
@AgentEnder
Copy link
Member

Hey @mlc-mlapis! As noted, this is an issue in the yargs package. I'm going to close this out, since the issue is not related to Nx directly (aside from nx using yargs). Once your PR has been released in yargs, we will investigate updating to the next version.

@mlc-mlapis
Copy link
Author

@AgentEnder Fine, that was the primary reason for creating the issue here + informing others about it.

we will investigate updating to the next version.

@nexdrew
Copy link

nexdrew commented Oct 16, 2022

Not sure if this helps, but you should be able to get around the problem by assuming another (non-Czech) locale when you run the nx CLI by setting a LC_ALL environment variable (per the os-locale package) that specifies a different language, perhaps like so:

LC_ALL=en nx migrate latest

Maybe give that a shot and let us know if it works. I assume it should then print out an error message in English.

@mlc-mlapis
Copy link
Author

@nexdrew Thanks for the tip. I tried it, and it works.

LC_ALL=en nx migrate latest

@mlc-mlapis
Copy link
Author

@AgentEnder Hi, the new version of Yargs is ready now, https://github.com/yargs/yargs/releases/tag/v17.6.1, can you update the Nx dependencies? The problem with the valid JSON structure of the Yargs cs.json file has been fixed already. Thanks.

@nexdrew
Copy link

nexdrew commented Nov 2, 2022

Note that yargs 17.6.1 has not yet been published to the npm registry ... hopefully will be soon.

@mlc-mlapis
Copy link
Author

@nexdrew I hope so. I didn't check. 💡

@nexdrew
Copy link

nexdrew commented Nov 2, 2022

It's published as latest now, so you should be good to go with upgrading the yargs dependency.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants