question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting export '_MatMenuDirectivesModule' was not found in '@angular/material/menu' on serving fresh installation

See original GitHub issue

Which @angular/* package(s) are the source of the bug?

compiler, Don’t known / other

Is this a regression?

Yes

Description

When removing my prevues package-lock.json and running installation (npm) and starting the project (ng-serve) I’m getting an error of the module _MatMenuDirectivesModule that cannot be found at: @angular/material/menu.

The post installation script is as follows: ngcc --properties es2015 browser module main. And I verified it compiled following:

Compiling @angular/material/menu : es2015 as esm2015
Compiling @angular/material/menu : main as umd.

When I’m switching back to my older package-lock.json and running installation I can see that the _MatMenuDirectivesModule module was properly declared under @angular/material/menu on menu-module.d.ts!!

The only relevant difference I can think of is the @angular/material versions diff, 12.2.13 vs 12.2.0 but it’s a minor version so why should that happen?

(My original scenario btw was copying the project into another folder without the node_modules and the package-lock.json and then I’ve faced the issue.)

Am I missing something here?

Angular dependencies tuned on version: 12.2.0

New package-lock.json

    "@angular/material": {
      "version": "12.2.13",
      "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.13.tgz",
      "integrity": "sha512-6g2GyN4qp2D+DqY2AwrQuPB3cd9gybvQVXvNRbTPXEulHr+LgGei00ySdFHFp6RvdGSMZ4i3LM1Fq3VkFxhCfQ==",
      "requires": {
        "tslib": "^2.2.0"
      }
    }

Old package-lock.json:

    "@angular/material": {
      "version": "12.2.0",
      "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.0.tgz",
      "integrity": "sha512-onrWWoukVDt+lBRFLAaw9JFjncGMKGBPRq0VyT/ppl6tfw3+l/AiQsUd9lzpFmZfkH6PZZwv97k/5eu+6Y8jdg==",
      "requires": {
        "tslib": "^2.2.0"
      }
    }

Error:

export '_MatMenuDirectivesModule' (imported as '_MatMenuDirectivesModule') was not found in '@angular/material/menu'

(possible exports: MAT_MENU_CONTENT, MAT_MENU_DEFAULT_OPTIONS, MAT_MENU_PANEL, MAT_MENU_SCROLL_STRATEGY, MatMenu, MatMenuContent, MatMenuItem, MatMenuModule, MatMenuTrigger, _MatMenuBase, _MatMenuContentBase, _MatMenuTriggerBase, fadeInItems, matMenuAnimations, transformMenu, ɵangular_material_src_material_menu_menu_a, ɵangular_material_src_material_menu_menu_b, ɵangular_material_src_material_menu_menu_c)

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

export '_MatMenuDirectivesModule' (imported as '_MatMenuDirectivesModule') was not found in '@angular/material/menu'

(possible exports: MAT_MENU_CONTENT, MAT_MENU_DEFAULT_OPTIONS, MAT_MENU_PANEL, MAT_MENU_SCROLL_STRATEGY, MatMenu, MatMenuContent, MatMenuItem, MatMenuModule, MatMenuTrigger, _MatMenuBase, _MatMenuContentBase, _MatMenuTriggerBase, fadeInItems, matMenuAnimations, transformMenu, ɵangular_material_src_material_menu_menu_a, ɵangular_material_src_material_menu_menu_b, ɵangular_material_src_material_menu_menu_c)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 12.2.0
Node: 14.15.5
Package Manager: npm 6.14.13
OS: darwin x64

@angular-devkit/architect       0.1202.0
@angular-devkit/build-angular   12.2.11
@angular-devkit/core            12.2.0
@angular-devkit/schematics      12.2.0
@angular/animations             12.2.4
@nguniversal/express-engine     11.1.1
@schematics/angular             12.2.0
rxjs                            6.6.7
typescript                      4.2.4

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
crisbetocommented, Dec 20, 2021

Closing since it looks like you’re trying to import a private API.

1reaction
JoostKcommented, Dec 20, 2021

Are you manually importing _MatMenuDirectivesModule, or did the compiler generate an import to that module?

As for the package.json output: please be aware that there are some packages that use ^, versus others that don’t. In particular @angular/animations is released together with the FW, so it should have the identical version to @angular/core. That’s likely not an issue in this case, I just wanted to mention it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Material Menu module: Export of name 'matMenu' not ...
Usually the application gets into this state when I generate something , or npm install a new package ... still want to understand...
Read more >
Angular Material “has no exported member 'MaterialModule'”
The idea being, you import what you need. This makes sense since as angular material is growing, I shouldn't have to package megabytes,...
Read more >
Warning when building CLI app in prod mode for mat-menu
after the update from angular material 5 to 6 when i try to build with "--prod" flag i give different warning such: "export...
Read more >
NG8003: No directive found with export - Angular
Use the string name of the export not found to trace the templates or modules using this export. Ensure that all dependencies are...
Read more >
Angular Material Menu: mat Menu example
step 3: Add matMenuTriggerFor Element. The above mat-menu element does not render anything in the UI. The menu should be attached to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found