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

--help throws TypeError: Cannot read property 'replace' of undefined #1757

Closed
springcomp opened this issue Dec 31, 2021 · 4 comments
Closed
Labels

Comments

@springcomp
Copy link

I’m learning to author Yeoman Generators and would like to use TypeScript.
I stumble across the following issue which has been closed. #1717

Here is a repro case:
https://github.com/springcomp/yeoman-custom-generator

The generator and its subcommand work (just prompting and logging for now).
However displaying help fails:

yo sample --help
yo sample:router --help

With the following message:

Error sample --help 
Cannot read property 'replace' of undefined

I cannot figure out how to troubleshoot this.

@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Jan 21, 2025
@JoshuaKGoldberg
Copy link

https://github.com/springcomp/yeoman-custom-generator no longer exists. @springcomp is this still something you want to investigate? We have a maintenance reboot (#1779) and we can walk you through it. 🙂

@springcomp
Copy link
Author

@JoshuaKGoldberg thanks for the feedback.

I’ll be retrying to create a repro and come back to this issue.

@springcomp
Copy link
Author

@JoshuaKGoldberg we can close that issue now. Sorry for the confusion.

As part of your reboot, are you planning to support ESM instead of CommonJS ?

@JoshuaKGoldberg
Copy link

we can close that issue now

Glad it worked out!

support ESM instead of CommonJS

Good question. It really depends on how much work it is.
In theory, now that Node.js supports require() of ESM (https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js -> https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require), issues like SBoudrias/Inquirer.js#1194 around using ESM in CJS should magically go away in the latest versions of Node.js. So you might find it all works out of the box now! ✨

But if not, I'd say that's a feature request issue to be filed on https://github.com/yeoman/yo. yeoman/yo#787 is related but looks to me more about source code running as ESM.

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

No branches or pull requests

2 participants