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

Copy error when trying to run a generator in the same environment twice #82

Closed
mwebler opened this issue May 11, 2017 · 4 comments
Closed

Comments

@mwebler
Copy link

mwebler commented May 11, 2017

Hello there,

I'm not sure if this is supposed to work like this or if this is an error. But, when you call the same environment to run a generator again, it causes an assertion error for copy and copyTpl with glob patterns:

AssertionError: Trying to copy from a source that does not exist: envir-test/node_modules/generator-generator/subgenerator/templates/templates/**

Example :

const yeoman = require('yeoman-environment');
const env = yeoman.createEnv();

env.lookup(() => {
  env.run('generator', {'skip-install': true}, err => {
    console.log('done');
    env.run('generator', {'skip-install': true}, err => {
        console.log('done');
    });
  });
});

Everything works fine if I create a new environment each time I execute the generator.

Versions:

  • yeoman-environment: "^1.6.6"
  • generator-generator: "^3.1.0",
  • Node v7.10.0
  • Windows 10
@SBoudrias
Copy link
Member

Do you have the generator code?

@mwebler
Copy link
Author

mwebler commented May 12, 2017

The error occurs using any generator which uses glob patterns in copy calls.

In the example above I'm running the generator-generator v3.1.0.

--EDIT--
To be more specific, just create an app following this gist,
It tries to run twice the generator-generator.

@rgroothuijsen
Copy link
Contributor

rgroothuijsen commented Dec 29, 2017

From what I can see by debugging the copy function, it adds files that were previously requested to an in-memory store, and somewhere along the way the globbed path is added to the list. On subsequent calls, it then mistakenly treats this as a literal path.

Edit: I think I found the issue. It's not what I'd expect to happen, but it happens when the code checks if a file path exists. At this point, mem-fs wrongly adds the invalid path entry to its store.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2020

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

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

3 participants