yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Slow Start Times #176

Open stephenplusplus opened 10 years ago

stephenplusplus commented 10 years ago

The ever-haunting issue with yo is the slow discovery of installed generators. I recall us getting it in check in the past, but has anyone else noticed it creeping up again?

alexkreidler commented 6 years ago

I am on a MacBook Pro with a fast SSD, yet Yeoman consistently take 1-2 seconds just to show the welcome menu. I hope these performance patches get released soon and we can see if they make a difference.

? 'Allo Tim! What would you like to do? (Use arrow keys)
  Run a generator
❯ Node Typescript
  ──────────────
  Update your generators
  Install a generator
  Find some help
  Clear global config
(Move up and down to reveal more choices)
DrogoNevets commented 5 years ago

Having same issue here where anything involving the yo command takes unacceptablly long.

anyone got any ideas?

Windows 10 too

axten commented 5 years ago

are there any updates here? for me, yo startup takes up to 10 seconds. this issue exist since we updated from 1.0 to 2.0.5...

yo 2.0.5 global installed mac book pro mojave with SSD

ghost commented 5 years ago

I'm in the same boat with Windows 10 and its taking 10sec. Globally installed, cleared out any other node modules I could live without (only 7 remain). I immediately thought the problem was completely down to the fact yeoman tries to search all locations for my generator, hence the 10 seconds. So I roughly threw yeoman into my CLI, hoping to avoid the "generator lookup" performance hit. It made a difference but not a massive difference. I went from 10seconds down to ~7sec.

Would it be helpful for me to post additional logs or metrics?

cliffred commented 5 years ago

I also experienced minutes of delay after running yo. I did some debugging and found it was caused by running npm -g prefix via spawnSync. (https://github.com/yeoman/environment/blob/da6411e978b833d4cbc710cb2b3f3dda965f66aa/lib/resolver.js#L216)

Then, I found this issue: https://npm.community/t/npm-version-takes-3-minutes-to-complete-when-run-in-child-process-and-behind-corporate-proxy/1658

After applying one of the workarounds mentioned there it was fixed: Set environment variable NO_UPDATE_NOTIFIER=1

This also works: npm config set update-notifier false

neilenns commented 4 years ago

I'm facing this issue on Windows 10 right now. Yeoman takes over 30 seconds to run my local generator, whereas my colleagues on a mac have it run in under a second. Any ideas what can be done to improve this? I have no need to look up external generators, I simply want to run my local one.

I did some more digging and this appears to be specific to running Yeoman inside WSL2 Unix instances on Windows 10. The same generator run from Powershell is fast, but when run inside WSL2 on Ubuntu takes over 40 seconds to start. This is with both my generator and a public one like Visual Studio Code's extension generator.

weshouman commented 2 years ago

👍 Thanks a lot @cliffred for the workaround, npm config set update-notifier false works like a charm.


❓ Does anybody know whether

  1. such delay could be fixed from yeoman's side or
  2. it stems from npm's usage of npm-update-notifier and thus has no fix from yeoman's side, and the issue could be closed by the aforementioned workaround?

    📝 Notes