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

Issue with v4 with local namespaces #497

Closed
nvuillam opened this issue Oct 21, 2023 · 7 comments
Closed

Issue with v4 with local namespaces #497

nvuillam opened this issue Oct 21, 2023 · 7 comments

Comments

@nvuillam
Copy link

I'm trying to upgrade in v4 because v3.x.x crashes when called from a JS module

But now I see the following error

For help, see: https://nodejs.org/en/docs/inspector
file:///C:/git/megalinter/mega-linter-runner/node_modules/yeoman-environment/dist/environment-base.js:205
                throw new TypeError(chalk.red(`You don't seem to have a generator with the name “${namespace?.generatorHint}” installed.`) +   
                      ^

TypeError: You don't seem to have a generator with the name “undefined” installed.

Here is how yeoman-environment is called

image

Do you have any tip ? :)

Copy link
Contributor

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

@github-actions github-actions bot added the stale label Nov 21, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2023
@strmer15
Copy link

strmer15 commented Jan 3, 2024

@mshima Can this be reopened? It looks like a problem with the parser in @yeoman/namespace not allowing local paths. I've opened yeoman/yeoman-api#5 for that, but this package would need to be updated with any new version.

@mshima
Copy link
Member

mshima commented Jan 3, 2024

Local paths should be converted to a valid namespace here:

const resolved = await resolveModulePath(namespaceOrPath);
if (resolved) {
const namespace = this.namespace(resolved);

@strmer15
Copy link

strmer15 commented Jan 3, 2024

Ah, ok - thanks for that info! Looks like it's throwing an error because the resolvedOrigin in the resolveModulePath function is undefined. If I comment out the else block in that function it seems to work correctly again for local paths.

Should I create a PR to remove that (or adjust that logic)? Or are you already working on a fix?

@mshima
Copy link
Member

mshima commented Jan 3, 2024

Please go ahead.

@strmer15
Copy link

strmer15 commented Jan 3, 2024

Please go ahead.

Thanks! I've created #504 to address it, let me know if that seems good.

@github-actions github-actions bot removed the stale label Jan 4, 2024
@mshima
Copy link
Member

mshima commented Jan 15, 2024

The sample usage is wrong, the bug is not valid. Should be:

await env.run([generatorPath]);

@strmer15 your usage looks related to relative paths.
Please post your use case in a new issue.

@mshima mshima closed this as completed Jan 15, 2024
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

Successfully merging a pull request may close this issue.

3 participants