Creating new component shows error:TypeError: core_1.PriorityQueue is not a constructor
Versions
Angular CLI: 1.6.4
Node: 8.9.4
OS: linux x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.6.4
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
Repro steps
- Running command
ng g c component
Observed behavior
core_1.PriorityQueue is not a constructor
TypeError: core_1.PriorityQueue is not a constructor
at new TaskScheduler (/home/praveen/academeics/node_modules/@angular-devkit/schematics/src/engine/task.js:20:23)
at SchematicEngine.createContext (/home/praveen/academeics/node_modules/@angular-devkit/schematics/src/engine/engine.js:81:31)
at SchematicImpl.call (/home/praveen/academeics/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:38)
at Promise (/home/praveen/academeics/node_modules/@angular/cli/tasks/schematic-run.js:73:23)
at new Promise (<anonymous>)
at Class.run (/home/praveen/academeics/node_modules/@angular/cli/tasks/schematic-run.js:72:16)
at Class.run (/home/praveen/academeics/node_modules/@angular/cli/commands/generate.js:161:33)
at resolve (/home/praveen/academeics/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
at new Promise (<anonymous>)
at Class.validateAndRun (/home/praveen/academeics/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
Desired behavior
Component should be created
###Deleting node_modules allowed creation of component and installing it again produces the above bug.

I had the same issue and solved it by adding devkit-core in version 0.0.29 to my devDependencies
"devDependencies": {
"@angular-devkit/core": "0.0.29",
...
}
or using with npm i -D @angular-devkit/[email protected]
This works for me:
I downgraded my globally installed angular cli to 1.5.0.
Just
npm remove -g @angular/cli
npm install -g @angular/[email protected]
I think this only works if your project is running on Angular 4
The same issue.
"devDependencies": {
"@angular/cli": "1.6.3"
}
I was able to resolve this same error by updating angular-cli to the latest version
npm remove -g @angular/cli
npm install -g @angular/cli@latest
and ensuring that the @angular/cli version in my package.json is fairly recent too. Then I completely removed the node_modules folder and did a fresh install.
Can someone provide a reproduction repository? I have not been able to reproduce this issue. Also, please update to the latest version fo the CLI which is currently 1.6.6 which has a fix for some of the generate issues which were reported.
Same here
Same here... Fixed it by adding "@angular-devkit/core": "0.0.29" to package.json for angular 5 using npm i -D @angular-devkit/[email protected] command
@gautamkrishnar & @nickroberts Thanks! I was able to get around the issue by following your solution.
@gautamkrishnar Really thanks! It works!
@gautamkrishnar and @buchmiller's comments seem to indicate this is fixed by updating. I think it's the same root cause as https://github.com/angular/angular-cli/issues/9194, which is fixed in 1.6.6 as detailed in https://github.com/angular/angular-cli/issues/9194#issuecomment-360615868.
thanks it works updated the package.json followed by npm install
npm i -D @angular-devkit /[email protected] it works update the package
@nilseckert +1 npm i -D @angular-devkit/core work for me !!
In my case, I solved using: npm install @angular-devkit/[email protected] --save-dev. I am using angular CLI 1.7.4
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.