How to resolve “core_1.PriorityQueue is not a constructor” in angular when creating a component or module

If you are generating angular component or module from angular cli using command ng g m [module name] and you get the error trace as below

TypeError: core_1.PriorityQueue is not a constructor
at new TaskScheduler (E:\angularapp\node_modules\@angular-devkit\schematics\src\engine\task.js:20:23)
at SchematicEngine.createContext (E:\angularapp\node_modules\@angular-devkit\schematics\src\engine\engine.js:81:31)
at SchematicImpl.call (E:\angularapp\node_modules\@angular-devkit\schematics\src\engine\schematic.js:35:38)
at Promise (E:\angularapp\node_modules\@angular\cli\tasks\schematic-run.js:73:23)
at new Promise (<anonymous>)
at Class.run (E:\angularapp\node_modules\@angular\cli\tasks\schematic-run.js:72:16)
at Class.run (E:\angularapp\node_modules\@angular\cli\commands\generate.js:152:33)
at resolve (E:\angularapp\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
at new Promise (<anonymous>)
at Class.validateAndRun (E:\angularapp\node_modules\@angular\cli\ember-cli\lib\models\command.js:240:12)

Then you are at the right location.

Solution
Open the package.json file of your application and search for angular-devkit/core dependency under devDependencies tag. It will look something like this.

“devDependencies”: {
“@angular-devkit/core”: “0.0.28”,
}

Error trace above is telling you that the angular-devkit/core version has gone older. Just update it to the latest version by running below command.

npm i @angular-devkit/core@latest

where i is the short-cut to install.
This will update the angular-devkit/core version. You can go and verify the version update in your package.json file. Now if you try to generate a component or module, it will be successfully generated without any errors.
Note that if you cannot update angular-devkit/core to the latest version, then update it to some higher version than the current version of your application using command

npm i @angular-devkit/core@0.0.029

0

Leave a Reply

Mark Your Impression

  Subscribe  
Notify of
Close Menu

Never Miss an article !

Get the new post delivered straight into your inbox, enter your email and hit the button

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

codippa will use the information you provide on this form to be in touch with you and to provide updates and marketing.