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

Running the generator from a local folder no longer works in 5.0.0 #797

Closed
sneridagh opened this issue Nov 15, 2023 · 14 comments · Fixed by #814
Closed

Running the generator from a local folder no longer works in 5.0.0 #797

sneridagh opened this issue Nov 15, 2023 · 14 comments · Fixed by #814

Comments

@sneridagh
Copy link

Type of issue

Bug

My environment

  • OS version/details: eg. Windows 10 64-bit
  • Node version: v20.9.0 (run node --version in your terminal)
  • npm version: 10.1.0 (run npm --version in your terminal)
  • Version of yo : 5.0.0 (run yo --version in your terminal)

Expected behavior

Running the generator from a local folder no longer works in 5.0.0

Current behavior

It shows that you need a generator instead of running the generator

Steps to reproduce the behavior

Try to run from a local folder instead of specifying the generator.

Command line output

❯ yo ./packages/generator-volto/generators/addon volto-test-addon -description "test volto addon" --volto . --skip-install --no-interactive -o testaddon
Error ./packages/generator-volto/generators/addon volto-test-addon -description test volto addon --volto . --skip-install --no-interactive -o testaddon

You don't seem to have a generator with the name “undefined” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/.
Install them with npm install undefined.

To see all your installed generators run yo --generators. Adding the --help option will also show subgenerators.

If yo cannot find the generator, run yo doctor to troubleshoot your system.
@strmer15
Copy link
Contributor

strmer15 commented Jan 3, 2024

I've tracked this down locally to the @yeoman/namespace package, which the yeoman-environment v4 uses to parse the generator's namespace, but it doesn't seem to work with local paths. I've created yeoman/yeoman-api#5 for that problem, and just to note that there was a related issue in yeoman-environment at yeoman/environment#497 for this too. cc @mshima

@tibbing
Copy link

tibbing commented Feb 26, 2024

@mshima Is there any plan to patch this? It seems both related issues have been closed. The yeoman v4 packages now contains sub-dependencies with vulnerabilities, and this prevents us from upgrading to yo@v5.

@mshima
Copy link
Member

mshima commented Feb 26, 2024

@tibbing because they have been fixed in yeoman/environment@cd68282.

@tibbing
Copy link

tibbing commented Feb 27, 2024

@tibbing because they have been fixed in yeoman/environment@cd68282.

@mshima Hmm, we are still observing the same error when generating locally using yo@5.0.0, yeoman-generator@7.1.1 and yeoman-environment@4.3.0:

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

I guess yeoman-environment needs to be upgraded in yo as well?

@TomerAberbach
Copy link
Contributor

Same. @mshima, are you planning to upgrade yeoman-environment to at least v4.2.0? Seems like we need that for the yo to work with a local folder. Also happy to send a PR with the upgrade if you're busy

@tibbing
Copy link

tibbing commented May 6, 2024

Hey @mshima! Would be awesome to get this patched, as @TomerAberbach said it's probably as simple as to upgrade yeoman-environment to the latest version 🙂

@mxiao-cll
Copy link

Hi all, when can we merge this fix?

@tibbing
Copy link

tibbing commented Nov 28, 2024

Hi all, when can we merge this fix?

I get the feeling that this package has been abandoned, no activity since February 🙁

@sneridagh
Copy link
Author

sneridagh commented Nov 29, 2024

It's not. We switched to a Python based boilerplate generator: cookiecutter if anyone is interested.
Unsubscribing too.

@mxiao-cll
Copy link

@mshima @addyosmani @arthurvr Can we get the PR merged and release?

@mshima
Copy link
Member

mshima commented Dec 13, 2024

yeoman-environment is a transient dependency it will be updated to latest version when yo is reinstalled. Unless you have it pinned anywhere else.
If the issue persists, check if the file of the generator exists and is relative to the current path or an absolute path to the file.

People are using local generators successfully yeoman/generator#1579

@mxiao-cll
Copy link

I found the issue, previously in 4.3.1 this works

yo ./dist/src/generator

Now in 5.0.0 you must do

yo ./dist/src/generator/generators/app/index.js

@mshima
Copy link
Member

mshima commented Dec 13, 2024

@mxiao-cll yo ./dist/src/generator/generators/app works?
If that's an issue please open a new issue so we can evaluate defaulting to app generator.

@mxiao-cll
Copy link

mxiao-cll commented Dec 13, 2024

Yes the above works as well, not an issue for me, I can just switch the path (maybe good to put in 5.0.0 release notes?)

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.

6 participants