diff --git a/lib/index.js b/lib/index.js index 61a5fb4b..0b39e76d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -14,7 +14,6 @@ const runAsync = require('run-async'); const through = require('through2'); const FileEditor = require('mem-fs-editor'); const createDebug = require('debug'); -const SubQueue = require('grouped-queue/lib/subqueue'); const Environment = require('yeoman-environment'); const Conflicter = require('./util/conflicter'); @@ -280,6 +279,15 @@ class Generator extends EventEmitter { // Backwards compatibilitiy with grouped-queue < 1.0.0 if (!this.env.runLoop.addSubQueue) { + let SubQueue; + try { + SubQueue = require('grouped-queue/lib/subqueue'); + } catch { + throw new Error( + "The running environment doesn't have the necessary features to run this generator. Update it and run again." + ); + } + this.env.runLoop.addSubQueue = function(name, before) { if (this.__queues__[name]) { // Sub-queue already exists