目标入口点“@angular/elements”中的错误缺少依赖项:
ERROR in The target entry-point "@angular/elements" has missing dependencies:
我几乎看过所有类似的帖子,但我无法使用这些步骤解决它。我一直在尝试使用 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
我已经试过了 -
- 清除 node_modules 并重新安装它们。
- 删除包-lock.json并按照步骤 1.
- 已清除 nom 缓存并执行步骤 1 和 2。
我不确定,是什么破坏了它?我一直在按照 angular 教程制作自定义网页元素,谢谢!
我可以通过以下步骤最终解决它:
- 已删除 node_modules
- 清除缓存
- npm i @angular/elements
- ng 添加@angular/elements
原因是 angular/elements 的依赖项没有正确安装,因此抛出错误。
我几乎看过所有类似的帖子,但我无法使用这些步骤解决它。我一直在尝试使用 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
我已经试过了 -
- 清除 node_modules 并重新安装它们。
- 删除包-lock.json并按照步骤 1.
- 已清除 nom 缓存并执行步骤 1 和 2。
我不确定,是什么破坏了它?我一直在按照 angular 教程制作自定义网页元素,谢谢!
我可以通过以下步骤最终解决它:
- 已删除 node_modules
- 清除缓存
- npm i @angular/elements
- ng 添加@angular/elements
原因是 angular/elements 的依赖项没有正确安装,因此抛出错误。