使用Angular CLI创建新组件时出现了一个奇怪的错误,当我使用ng g c navbar
时抛出错误:
core_1.PriorityQueue is not a constructor
TypeError: core_1.PriorityQueue is not a constructor
at new TaskScheduler (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular-devkit/schematics/src/engine/task.js:20:23)
at SchematicEngine.createContext (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular-devkit/schematics/src/engine/engine.js:81:31)
at SchematicImpl.call (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:38)
at Promise (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular/cli/tasks/schematic-run.js:73:23)
at new Promise (<anonymous>)
at Class.run (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular/cli/tasks/schematic-run.js:72:16)
at Class.run (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular/cli/commands/generate.js:161:33)
at resolve (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
at new Promise (<anonymous>)
at Class.validateAndRun (/home/praveen/Desktop/Angular_Projects/a2website/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
任何人都可以帮助我吗?。提前谢谢。
答案 0 :(得分:21)
在你的package.json中,你会看到:
security:
firewalls:
firewall_api:
pattern: '^/(.*)+$'
host: '^api\.mypage\.com$'
stateless: true
anonymous: false
guard:
# list of authenticators to try
authenticators:
- 'My\Bridge\Symfony\Security\Authenticator\Guard\JWTTokenAuthenticator'
- 'My\Bridge\Symfony\Security\Authenticator\Guard\FacebookAuthenticator'
# This authenticator's start() method is called
entry_point: 'My\Bridge\Symfony\Security\Authenticator\Guard\JWTTokenAuthenticator'
运行更新的命令:
"devDependencies": {
"@angular-devkit/core": "OLD VERSION", <----- once you run the command this will update
...
}
答案 1 :(得分:2)
更新角度cli或确保运行最新版本的角度cli。
要安装最新版本的angular cli,请使用以下命令:
npm install -g @angular/cli@latest