angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

Creating new component shows error:TypeError: core_1.PriorityQueue is not a constructor #9374

Closed praveenojha33 closed 6 years ago

praveenojha33 commented 6 years ago

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

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.

error

nilseckert commented 6 years ago

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/core@0.0.29

BreadBomb commented 6 years ago

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/cli@1.5.0

I think this only works if your project is running on Angular 4

Oakerin commented 6 years ago

The same issue.

"devDependencies": { "@angular/cli": "1.6.3" }

buchmiller commented 6 years ago

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.

Brocco commented 6 years ago

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.

tigredonorte commented 6 years ago

Same here

gautamkrishnar commented 6 years ago

Same here... Fixed it by adding "@angular-devkit/core": "0.0.29" to package.json for angular 5 using npm i -D @angular-devkit/core@0.0.29 command

olakara commented 6 years ago

@gautamkrishnar & @nickroberts Thanks! I was able to get around the issue by following your solution.

Oakerin commented 6 years ago

@gautamkrishnar Really thanks! It works!

filipesilva commented 6 years ago

@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.

omganesh commented 6 years ago

thanks it works updated the package.json followed by npm install

sudheerkosanam commented 6 years ago

npm i -D @angular-devkit /core@0.0.29 it works update the package

fahedalh commented 6 years ago

install this :+1: $ npm i -D @angular-devkit/core@0.0.29

it will solve the problem

hardy12994 commented 6 years ago

@nilseckert +1 npm i -D @angular-devkit/core work for me !!

pugillum commented 6 years ago

In my case, I solved using: npm install @angular-devkit/core@0.3.2 --save-dev. I am using angular CLI 1.7.4

angular-automatic-lock-bot[bot] commented 5 years ago

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.