微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

(角 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'

解决方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。