Search code examples
yeoman

Yeoman generator startup extremely slow


I've created a Yeoman generator that used to work in a fairly snappy manner for me. Recently, performance has plummeted to stupendous lows, requiring me to wait as much as five minutes every time I can a simple yo generator-name. This is making it extremely difficult for me to work, and there seems to be no help on the Yeoman issues board.

I've tried turning on the verbose Yeoman debugging, and after five minutes of waiting, the very first yeoman:generator statement appears. Here's what I get:

> yo @my/generator:subgen tryNumberOne
  yeoman:generator Queueing initializing in initializing +0ms
  yeoman:generator Queueing prompting in prompting +4ms
  yeoman:generator Queueing writing in writing +0ms
  yeoman:generator Queueing end in end +0ms
  yeoman:generator Running initializing +4ms
Creating pure component file

- Initializing
  yeoman:generator Running prompting +4ms

The worst part is that I've verified that this works properly on another team member's PC. It's very snappy and no performance issues, so the problem isn't the code.

The only thing I can think of is that there's something amiss with how Yeoman is looking for dependencies on my machine, or it's trying to find something over the network and timing out, then running normally. Unfortunately, there's no way for me to test my theory that I can see.

Trying to use the node inspector breaks spectacularly:

node --inspect-brk C:\Progra~1\nodejs\yo -i @my/generator:subgen tryTwo

Debugger listening on ws://127.0.0.1:9229/b56a9400-57c0-407d-9fb8-a114b6c6df47
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
C:\Users\myuser\AppData\Roaming\nvm\v8.11.3\yo:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
Waiting for the debugger to disconnect...
^C

Using the ws:// protocol url above doesn't work in the browser, of course. You have to change it to http://, then add /json/list, and pull the real url from there to open the debugger in Chrome. Even then, the output is still SyntaxError: missing ) after argument list

I can even run just a simple yo command and the gruelling wait is still in place, so even the generator itself isn't the issue.

Does anyone have any idea what's going on here?


Solution

  • I've continued to monitor this, and the issue has been resolved as of version 2.0.5. Anyone having this issue with any version prior to this should upgrade as soon as possible.

    If you can't upgrade for some reason, then stick with 1.8.5, as I mentioned in the comment over in the Yeoman issue boards.