angular - 更新 Angular 8.0 后,模块没有导出的成员组件

标签 angular angular-cli angular8

错误

ERROR in src/app/custom-filterdt/custom-filterdt.component.ts(11,4): error TS2554: Expected 2 arguments, but got 1.

typescript 代码

 import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
 import { DataTableDirective } from 'angular-datatables';
  @Component({
    selector: 'app-custom-filterdt',
    templateUrl: './custom-filterdt.component.html',
    styleUrls: ['./custom-filterdt.component.css']
    })

代码错误

import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';

错误信息

import Component Module '"../../../node_modules/@angular/core/core"' has no exported member 'Component'.ts(230

NG版本

                            Angular CLI: 8.0.3
                            Node: 12.4.0
                            OS: win32 x64
                            Angular: 8.0.1
                            ... animations, cdk, common, compiler, compiler-cli, core, forms
                            ... language-service, material, platform-browser
                            ... platform-browser-dynamic, router, service-worker

                            Package                           Version
                            -----------------------------------------------------------
                            @angular-devkit/architect         0.800.3
                            @angular-devkit/build-angular     0.800.3
                            @angular-devkit/build-optimizer   0.800.3
                            @angular-devkit/build-webpack     0.800.3
                            @angular-devkit/core              8.0.3
                            @angular-devkit/schematics        8.0.3
                            @angular/cli                      8.0.3
                            @angular/http                     7.2.15
                            @angular/pwa                      0.800.3
                            @ngtools/webpack                  8.0.3
                            @schematics/angular               8.0.3
                            @schematics/update                0.800.3 (cli-only)
                            rxjs                              6.5.2
                            typescript                        3.4.5
                            webpack                           4.30.0
  • 非常欢迎任何帮助

上述问题通过删除node模块即可解决

但是在这个新错误之后

Expected 2 arguments, but got 1.ts(2554) core.d.ts(8064, 47): An argument for 'opts' was not provided

 viewchild @ViewChild('maincontent') mainContent: any; An argument for 'opts' was not provided.  error TS2554: Expected 2 arguments, but got 1 in v8

typescript

 export class ViewchildexampleComponent implements OnInit {
 @ViewChild('maincontent') mainContent: any;

最佳答案

正如 SiddAjmera 建议删除 node_modules 文件夹并运行 npm install 似乎可以解决该问题。解决了我的列表

关于angular - 更新 Angular 8.0 后,模块没有导出的成员组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56662499/

相关文章:

node.js - 为什么 Angular 2 不加载默认的 app-root 组件?

async-await - 如何等待订阅功能以角度 8 完成?

javascript - 如何一次性获取BehaviorSubject的当前值?

spring - 如何在 Spring MVC 中为错误响应启用 CORS?

html - Angular 2 中的验证

mysql - Sequelize : How to make use of multiple operators to create a fetch of objects with an exclusion clause

json - '+' 字符在 HttpParams Angular 6 中转换为空格

css - Angular 2 - 到处都是重复的 <style> block

angular - 如何使用 Angular CLI 在特定文件夹中生成组件?

rxjs - 如何取消来自许多角度 8 的待处理 http 请求之一