我看过几乎所有类似的帖子,但我无法使用这些步骤解决它。我一直在尝试使用 Angular 9 创建一个 web 组件。Angular 版本和详细信息是:
AV:webcomponents apoorvachikara$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.1.15
Node: 10.19.0
OS: darwin x64
Angular: 9.1.13
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.15
@angular-devkit/build-angular 0.901.15
@angular-devkit/build-optimizer 0.901.15
@angular-devkit/build-webpack 0.901.15
@angular-devkit/core 9.1.15
@angular-devkit/schematics 9.1.15
@angular/cli 9.1.15
@angular/elements 11.2.7
@ngtools/webpack 9.1.15
@schematics/angular 9.1.15
@schematics/update 0.901.15
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
当我使用 angular-cli 创建一个新项目时它运行良好,但是当我添加 @angular/elements
时它跳过安装并在下面抛出异常:
AV:webcomponents apoorvachikara$ ng add @angular/elements
Skipping installation: Package already installed
An unhandled exception occurred: Cannot find module '@angular-devkit/schematics'
See "/private/var/folders/0f/z1g4yzrn2wx4d7fjn17wsybr0000gn/T/ng-EYiR8c/angular-errors.log" for further details.
现在,当我尝试运行 angular 应用程序时,它会抛出
ERROR in The target entry-point "@angular/elements" has missing dependencies:
- @angular/core
- rxjs
我已经尝试过的 -
我不确定,是什么破坏了它?我一直在关注 angular 教程来制作自定义网页元素,谢谢!
答案 0 :(得分:1)
我最终可以使用以下步骤解决它:
原因是 angular/elements 的依赖没有正确安装,导致抛出错误。