1

我正在尝试在我的角度项目上运行 ng build 但我不断收到错误消息

ERROR in Unexpected value 'MatTooltipModule in /Users/strypeez/Dropbox/gosco-webNEW/gosco-webUPTODATE/node_modules/@angular/material/tooltip/typings/index.d.ts' imported by the module 'AppModule in /Users/strypeez/Dropbox/gosco-webNEW/gosco-webUPTODATE/src/app/app.module.ts'. Please add a @NgModule annotation.

这就是我在 app.module.ts 中导入它的方式

import {MatTooltipModule} from '@angular/material/tooltip';

我有它在我的进口

imports: [
    FormsModule,
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatTooltipModule, ]

我能做些什么来修复错误?

编辑:我添加了我的依赖项,有什么会导致问题吗?

"dependencies": {
    "@angular/animations": "^4.1.3",
    "@angular/cdk": "^2.0.0-beta.12",
    "@angular/common": "^4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/material": "^2.0.0-beta.12",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@angular/router": "4.1.3",
    "@angular/upgrade": "4.1.3",
}
4

1 回答 1

0

这可能是错误的导入,我现在没有要测试的环境,但是根据 Angular Material,您需要将其导入为:

import {MatTooltipModule} from '@angular/material';

这是文档: https ://material.angular.io/components/tooltip/api

当我用一个旧的角度项目尝试它时,我似乎没有零问题。 在此处输入图像描述 在此处输入图像描述

还有我的依赖:

"@agm/core": "1.0.0-beta.0",
"@angular/animations": "4.4.4",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "4.4.4",
"@angular/compiler": "4.4.4",
"@angular/core": "4.4.4",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/forms": "4.4.4",
"@angular/http": "4.4.4",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "4.4.4",
"@angular/platform-browser-dynamic": "4.4.4",
"@angular/router": "4.4.4",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.29",
"@ngrx/effects": "^4.0.1",
"@ngrx/store": "^4.0.0",
"@ngrx/store-devtools": "^4.0.0",
"@ngx-translate/core": "7.1.0",
"@ngx-translate/http-loader": "1.0.1",
"@swimlane/ngx-charts": "6.0.1",
"@swimlane/ngx-datatable": "9.3.1",
"angular-calendar": "0.19.0",
"angular-datatables": "^4.4.1",
"angular-tree-component": "3.8.0",
"angular2-datatable": "^0.6.0",
"angular2-text-mask": "8.0.2",
"angularfire2": "^4.0.0-rc.1",
"bootstrap": "4.0.0-alpha.6",
"classlist.js": "^1.1.20150312",
"core-js": "2.4.1",
"d3": "^4.8.0",
"datatables.net": "^1.10.16",
"datatables.net-dt": "^1.10.16",
"dragula": "3.7.2",
"firebase": "4.1.3",
"hammerjs": "2.0.8",
"intl": "^1.2.5",
"jquery": "^3.2.1",
"ng-sidebar": "6.0.1",
"ng2-ckeditor": "^1.1.9",
"ng2-dragula": "1.5.0",
"ng2-file-upload": "1.2.1",
"ng2-quill-editor": "^2.0.0",
"ng2-validation": "4.2.0",
"quill": "1.3.0",
"resize-observer-polyfill": "^1.4.2",
"rxjs": "5.4.2",
"screenfull": "3.3.1",
"spinthatshit": "1.0.3",
"text-mask-addons": "3.6.0",
"web-animations-js": "^2.2.5",
"zone.js": "0.8.10"
于 2018-04-17T21:59:31.963 回答