ng build错误而非ngModule

时间:2018-04-17 17:27:40

标签: angular angular-cli ng-build

我正在尝试在我的角项目上运行构建,但我一直收到错误

      <div class="section1">
        <section>
          <div class="parallax">
            <v-layout
              column
              align-center
              justify-center
              class="white--text"
            >
              <img src="../assets/images/vuetify.png" alt="Vuetify.js" height="200">
            </v-layout>
          </div>
        </section>
      </div>
    </template>


    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped lang="scss">
    .parallax {
      background-image: url('../assets/images/hero.jpeg');
      background-size:cover;
      /* Set a specific height */
      min-height: 600px;
      /* Create the parallax scrolling effect */
      background-attachment: fixed;
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;
    }
    </style>

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

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.

我在我的导入中有它

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

我该怎么做才能解决错误?

编辑:我添加了我的依赖项,是否会导致问题?

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

1 个答案:

答案 0 :(得分:0)

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

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

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

当我尝试使用旧的角度项目时,我似乎没有问题。 enter image description here enter image description here

我的依赖项:

"@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"