找不到模块:错误:无法解析“@angular/core/src/render3”:ViewChildren QueryList

时间:2021-06-04 05:35:23

标签: angular angular5 viewchildren

(角 CLI:1.7.4)

我在组件中使用 ViewChildren。如果我将其定义为

,则它工作正常
@ViewChildren(TestComponent) testComponents;

但是,当我将 testComponents 的类型指定为 QueryList 时:

@ViewChildren(TestComponent) testComponents: QueryList<TestComponent>;

它给出了错误:

ERROR in ./src/app/components/search-component/search.component.ts Module not found: Error: Can't resolve '@angular/core/src/render3' in 'D:\Test Applications\test-application\src\app\components\search-component'

1 个答案:

答案 0 :(得分:0)

删除 node-module 文件夹并从根目录运行“npm install”命令。这将安装 package.json 文件中列出的所有依赖项。如果要安装特定的包,请执行“npm i 你的包名”。 如果它不起作用,请告诉我?

相关问题