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

Crash when space in yeoman generator path #366

Closed
nvuillam opened this issue Aug 28, 2021 · 10 comments · Fixed by #368
Closed

Crash when space in yeoman generator path #366

nvuillam opened this issue Aug 28, 2021 · 10 comments · Fixed by #368

Comments

@nvuillam
Copy link

A mega-linter user detected a crash in the generator because there is a space in its windows username

Please could you check ?

C. A. M. Gerlach@QUASIMODO MINGW64 ~/Documents/dev/SpaceX/submanager (master)
$ npx mega-linter-runner@beta --install
Yeoman generator used: C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\mega-linter-runner\generators\mega-linter
C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\yeoman-environment\lib\environment.js:747
        throw new Error(
              ^

Error: You don't seem to have a generator with the name “C:\Users\C.” 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 generator-C:\Users\C..

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

If yo cannot find the generator, run yo doctor to troubleshoot your system.
    at checkGenerator (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\yeoman-environment\lib\environment.js:747:15)
    at Environment.create (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\yeoman-environment\lib\environment.js:774:29)
    at instantiateAndRun (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\yeoman-environment\lib\environment.js:987:36)
    at Environment.run (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\yeoman-environment\lib\environment.js:1004:12)
    at MegaLinterRunner.run (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\mega-linter-runner\lib\runner.js:47:11)
    at MegaLinterRunnerCli.run (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\mega-linter-runner\lib\cli.js:11:34)
    at C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\mega-linter-runner\lib\index.js:13:37
    at Object.<anonymous> (C:\Users\C. A. M. Gerlach\AppData\Local\npm-cache\_npx\bcc0ed12329339b9\node_modules\mega-linter-runner\lib\index.js:14:5)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)

Thanks :)

oxsecurity/megalinter#676

@CAM-Gerlach
Copy link

In addition, I tested a global install, and ran into the same issue running it on Windows. In this case, it seems it will likely occur for any Windows user installing globally (at least that has npm installed in the standard Program Files location) because the Program Files directory contains a a space.

C. A. M. Gerlach@QUASIMODO MINGW64 ~/Documents/dev/SpaceX/submanager (update-cis-post-060)
$ mega-linter-runner --install
C:\Program Files\nodejs\node_modules\mega-linter-runner\node_modules\yeoman-environment\lib\environment.js:630
        new Error(
        ^

Error: You don't seem to have a generator with the name “C:\Program” 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 generator-C:\Program.

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

If yo cannot find the generator, run yo doctor to troubleshoot your system.
    at Environment.create (C:\Program Files\nodejs\node_modules\mega-linter-runner\node_modules\yeoman-environment\lib\environment.js:630:9)
    at instantiateAndRun (C:\Program Files\nodejs\node_modules\mega-linter-runner\node_modules\yeoman-environment\lib\environment.js:729:30)
    at Environment.run (C:\Program Files\nodejs\node_modules\mega-linter-runner\node_modules\yeoman-environment\lib\environment.js:758:12)
    at MegaLinterRunner.run (C:\Program Files\nodejs\node_modules\mega-linter-runner\lib\runner.js:43:11)
    at MegaLinterRunnerCli.run (C:\Program Files\nodejs\node_modules\mega-linter-runner\lib\cli.js:11:34)
    at C:\Program Files\nodejs\node_modules\mega-linter-runner\lib\index.js:13:37
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\mega-linter-runner\lib\index.js:14:5)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)

@github-actions
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

@CAM-Gerlach
Copy link

As far as I am aware, this is still a critical bug.

@github-actions
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

@nvuillam
Copy link
Author

Not stale ? :)

@mshima mshima transferred this issue from yeoman/generator Nov 8, 2021
@mshima
Copy link
Member

mshima commented Nov 8, 2021

Need to add space support to namespace().

describe('#namespace()', () => {

@mshima
Copy link
Member

mshima commented Nov 8, 2021

Spaces are not the problem, but package name that doesn't start with generator-.

@nvuillam
Copy link
Author

nvuillam commented Nov 8, 2021

The generator integration is not the main use of mega-linter-runner, so it can not contain generator- in its name :/

@mshima
Copy link
Member

mshima commented Nov 8, 2021

The PR should fix the problem when the package is inside a node_modules repository, but it won't help if not.

@CAM-Gerlach
Copy link

Hey, sorry I didn't see this in time to test it, and thanks so much for the fix.

The PR should fix the problem when the package is inside a node_modules repository, but it won't help if not.

This should fix the issue I reported, since in both cases the package was inside node_modules. Just to confirm, is this expected to fix it in the global node_modules rather than a local one? While not in my case (the spaces were in my homedir), on Windows this is likely to happen much more widely with npm -g since that path by default contains a space. Thanks!

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