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

generator.run is not a function when i use [email protected] #296

Open
dribble-njr opened this issue Jan 9, 2024 · 6 comments
Open

generator.run is not a function when i use [email protected] #296

dribble-njr opened this issue Jan 9, 2024 · 6 comments

Comments

@dribble-njr
Copy link

Environment

  • Node version: v18.17.0
  • npm version: 9.6.7
  • Version of yo : 5.0.0

behavior

Run the following code:

yo node

After I complete the questions, it happens an error:

image

Accoring to issue796, maybe the yeoman-generator version is too old.

@JoseCarlosGZ

This comment has been minimized.

@YadOwO

This comment has been minimized.

@YadOwO

This comment has been minimized.

@ntt77

This comment has been minimized.

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jan 24, 2025

👋 Hi all! We're resuming maintenance on Yeoman and picking up old issues like this one. See yeoman/yeoman#1779.

I can reproduce this locally with:

npm i -g yo generator-node
yo node
yo node
(node:76706) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
? Module Name yotest
(node:76706) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
? The name above already exists on npm, choose another? No
? Description 
? Project homepage url 
? Author's Name Josh Goldberg
? Author's Email [email protected]
? Author's Homepage 
? Package keywords (comma to split) 
? Send coverage reports to coveralls Yes
? Enter Node versions (comma separated) 
? GitHub username or organization JoshuaKGoldberg
Error node 

generator.run is not a function

I think this issue is similar to yeoman/generator-generator#258. Both generators are using old versions of Yeoman dependencies.

I tried updating the yeoman-generator dependency to the latest ^7.4.0 but was hit with the always-lovely:

require() of ES Module /Users/josh/repos/generator-node/node_modules/yeoman-generator/dist/index.js from /Users/josh/repos/generator-node/generators/app/index.js not supported.
Instead change the require of /Users/josh/repos/generator-node/node_modules/yeoman-generator/dist/index.js in /Users/josh/repos/generator-node/generators/app/index.js to a dynamic import() which is available in all CommonJS modules.

...so using the latest yeoman-generator dependency is blocked on #298.


I can't promise exactly when we'll resolve #265 and unblock this issue, but I'm hoping it'll be Soon ™. I've hidden other comments in this thread to emphasize that. Cheers! 🎩

@JoshuaKGoldberg JoshuaKGoldberg pinned this issue Jan 24, 2025
@JoshuaKGoldberg
Copy link

Oh, and this is the stack locally for debugging:

 TypeError: generator.run is not a function
      at runGenerator (/Users/josh/repos/generator-generator/node_modules/generator-node/node_modules/yeoman-generator/lib/index.js:36:15)
      at module.exports.composeWith (/Users/josh/repos/generator-generator/node_modules/generator-node/node_modules/yeoman-generator/lib/index.js:1292:7)
      at module.exports.default (/Users/josh/repos/generator-generator/node_modules/generator-node/generators/app/index.js:332:12)
      at Object.<anonymous> (/Users/josh/repos/generator-generator/node_modules/generator-node/node_modules/yeoman-generator/lib/index.js:991:25)
      at /Users/josh/repos/generator-generator/node_modules/run-async/index.js:49:25
      at new Promise (<anonymous>)
      at /Users/josh/repos/generator-generator/node_modules/run-async/index.js:26:19
      at runLoop.add.once.once (/Users/josh/repos/generator-generator/node_modules/generator-node/node_modules/yeoman-generator/lib/index.js:992:11)
      at Immediate.<anonymous> (/Users/josh/repos/yo/node_modules/grouped-queue/lib/subqueue.js:48:34)
      at process.processImmediate (node:internal/timers:483:21)

Captured in yo's const onError.

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

No branches or pull requests

5 participants