1

I am trying to run ng build on my angular project but I keep getting the error

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.

This is how I am importing it in my app.module.ts

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

and I have it in my imports

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

What can I do to fix the error?

Edit: I added my dependencies, would anything cause an issue?

"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",
}
strypeez
  • 175
  • 1
  • 3
  • 16
  • can you post your app.module.ts? – Juan Apr 18 '18 at 04:15
  • First I would upgrade angular and including `@angular/material`, then in `app.module` import it from: `@angular/material` and after that add it to imports and exports. Please check: [link](https://stackblitz.com/edit/float?file=main.ts) – k.vincent Apr 18 '18 at 10:25

1 Answers1

0

This could be a wrong import, I don't have the environment to test now but, according to the Angular Material, you need to import it as:

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

Here's the documentation: https://material.angular.io/components/tooltip/api

I seem to have zero problems when I try it with an old angular project. enter image description here enter image description here

Also my dependencies:

"@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"
ReturnTable
  • 355
  • 4
  • 12
  • You can refer to the screenshots I have posted, I have tried the example on my environment and it seems to work just fine. Did you try to run just the example? Also I have had issues with node modules before, it wouldn't hurt to remove the folder for a fresh npm i. – ReturnTable Apr 18 '18 at 03:09
  • I posted my dependencies, would anything there be an issue cause I have already reinstalled the node modules – strypeez Apr 18 '18 at 04:10
  • @strypeez I also added my dependencies, it wouldn't hurt to try to upgrade your dependencies to what I was using when I was building this as it seems to be working fine. – ReturnTable Apr 18 '18 at 05:57