generator-generator
generator-generator copied to clipboard
instantiatedGenerator.run is not a function
cann't create an app。
node and package version
node v18.17.0 npm 9.6.7 yo 5.0.0 generator-generator 5.1.0
System
OS: macOS 12.6 CPU: (8) arm64 Apple M1
getting the same error , any update ?
I'm getting the same error as well.
Error generator
instantiatedGenerator.run is not a function
| Name | Version |
|---|---|
| Node | v20.10.0 |
| NPM | 10.2.3 |
| yo | 5.0.0 |
| generator-generator | 5.0.0/5.1.0 |
System
OS: Windows 11 22H2 CPU: Intel Core i9 RAM: 32GB
Most likely introduced here: https://github.com/yeoman/environment/commit/3dc26947b70b686c87313ae64120584f3d8e26a2#diff-24984142d58a41889c987b60103bcd93653f3551f71f6cdf22b5762e885c9cd6L758
- https://github.com/yeoman/environment/pull/462
- https://github.com/yeoman/yo/pull/793
- https://github.com/yeoman/generator/pull/1478
It didn't return a promise before
been getting the same error...
Workaround
I had to downgrade yo to get it working, for example
npm install -g [email protected] generator-generator
Hey! Any news about this issue? Is there another way for this to work except to downgrade? Did the method changed?
Thank you
any help ?
Hello,
I'm also getting same error. Is this the dead end, or there some hopes ?
Thanks.
Hi, any solutions except for downgrading?
hello, any solutions?
We adjusted version and it worked
Pagarbiai
Aivaras Šavinis +370 (656) 69 221 @.*** http://www.linkedin.com/in/aivaras-savinis
On Mon, 6 May 2024 at 18:32, AmroKhatib77 @.***> wrote:
hello, any solutions?
— Reply to this email directly, view it on GitHub https://github.com/yeoman/generator-generator/issues/258#issuecomment-2096310387, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARCIZZMDIVUPIBRDFZEORATZA6PCPAVCNFSM6AAAAAA724UQ72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWGMYTAMZYG4 . You are receiving this because you commented.Message ID: @.***>
Workaround I had to downgrade
yoto get it working, for examplenpm install -g [email protected] generator-generator
December 20. Project ded?
npm install -g [email protected]
npm install -g [email protected] I resolved by installing this version. maybe you should try.
Check the yeoman-generator version that you use in your generator. This error is present in version 3. If you use JS to write your generator, try 5.10.0 instead, as higher versions only support esmodule
any solutions?
I worked through detailed debugging to understand how to write a generator that works with the latest yeoman yo and generator. At this point none of the Yeoman documentation describes how to build a working generator with the latest version. I'm thinking this project needs to be updated in a similar way. Based on my efforts with my generator, it looks like this project needs to refactored to use import instead of require. Here's a fully functioning generator example that uses the latest version of yeoman and the yeoman generator: https://github.com/yenoh2/generator-hac-tf-module
- update your package.json adding "type": "module"
- Since the newer version uses ESM you need to update your generator use imports instead of 'require' in your index.js file. Example: import _ from 'lodash'; import Generator from 'yeoman-generator'; import askName from 'inquirer-npm-name'; import { createRequire } from 'module'; const require = createRequire(import.meta.url); // see full example here: https://github.com/yenoh2/generator-hac-tf-module/blob/master/generators/app/index.js
- Your export for your extended generator should look like this: export default class extends Generator {
Still getting this - is the project dead? Also, has anyone successfully implemented yenoh2's fix?
Getting the same error. Any progress so far?
Either the project is dead or we need to get plop using EJS instead of handlebars.
I had to roll back, but that worked. Looks like this version is bust (and the lack of response on the thread suggests the project is too)!
Having the same issue.
Workaround I had to downgrade
yoto get it working, for examplenpm install -g [email protected] generator-generator
I´ve tried with this, it works. Thanks @Aiwwa
Running yo generator fails with
Error generator
instantiatedGenerator.run is not a function
Environment:
node -v
v20.18.1
npm -v
11.0.0
yo --version
5.1.0
npm list -g generator-generator
/usr/local/share/nvm/versions/node/v20.18.1/lib
└── [email protected]
Check the yeoman-generator version that you use in your generator. This error is present in version 3. If you use JS to write your generator, try 5.10.0 instead, as higher versions only support esmodule
what the ???? is it? I used the latest one 5.10 and still got this issue
👋 Hi all! We're resuming maintenance on Yeoman and picking up old issues like this one. See https://github.com/yeoman/yeoman/issues/1779.
I can reproduce this locally with:
npm i -g yo generator-generator
yo generator
yo generator
? Your generator name generator-yotest
? The name above already exists on npm, choose another? No
Your generator must be inside a folder named generator-yotest
I'll automatically create this folder.
(node:60092) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Just found a `.yo-rc.json` in a parent directory.
Setting the project root at: /Users/josh/repos/yotest
Error generator
instantiatedGenerator.run is not a function
Digging through, I'm pretty sure the root cause is that generator-generator depends on a very old version of yeoman-generator:
https://github.com/yeoman/generator-generator/blob/f5b3ed87b7a785f85b64ec90de45fbfe88e6e273/package.json#L37
The variable name instantiatedGenerator no longer exists in the latest versions of yeoman-generator. In the Git history, the instantiatedGenerator.run line hasn't existed for a few years. It was refactored away starting in https://github.com/yeoman/generator/pull/1206: https://github.com/yeoman/generator/pull/1206/files#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1L941-R979 and continuing through a bunch of subsequent changes to the file.
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-generator/node_modules/yeoman-generator/dist/index.js from /Users/josh/repos/generator-generator/app/index.js not supported.
Instead change the require of /Users/josh/repos/generator-generator/node_modules/yeoman-generator/dist/index.js in /Users/josh/repos/generator-generator/app/index.js to a dynamic import() which is available in all CommonJS modules.
...so using the latest yeoman-generator dependency is blocked on #265.
I can't promise exactly when we'll resolve #265 and unblock this issue, but I'm hoping it'll be Soon ™. In the meantime downgraded npm install -g [email protected] generator-generator does seem to fix this issue. I've hidden other comments in this thread to emphasize that. Cheers! 🎩
up!