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

TypeError: Cannot read properties of undefined (reading 'reduce') at Generator.next (<anonymous>) #5

Open
lewebsimple opened this issue Jun 18, 2024 · 2 comments

Comments

@lewebsimple
Copy link

I just discovered your fork and needed the .hygen.cjs support but when executing hypergen ... inside my project it fails with the error from the title.

TypeError: Cannot read properties of undefined (reading 'reduce')
TypeError: Cannot read properties of undefined (reading 'reduce')
    at /home/pascal/.nvm/versions/node/v20.11.1/lib/node_modules/hypergen/dist/params.js:74:52
    at Generator.next (<anonymous>)
    at fulfilled (/home/pascal/.nvm/versions/node/v20.11.1/lib/node_modules/hypergen/dist/params.js:5:58)
@svallory
Copy link
Owner

@lewebsimple maaaan! Not sure how I missed the notification for this. So sorry for never getting back to you!

Looks like I messed up something there, but the issue seems to be in the findGenerators function returning undefined. Which should never happen.

I'll take a look at this soon.

And if you by any chance still remember any details on how to reproduce it, let me know!

But I'm guessing install, add config and no generators, right?

@svallory
Copy link
Owner

I just figured out what the issue is. It happens when the project was not initialized yet and you try to generate a generator.

Until a fix is up, the workaround is:

  1. Init the project running hypergen init self at the root
  2. Remove the init generator (sorry, another bug :/) rm -rf ./_templates/init
  3. Generate your first generator with hypergen generator new MyGenerator

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

No branches or pull requests

2 participants