Getting export '_MatMenuDirectivesModule' was not found in '@angular/material/menu' on serving fresh installation
See original GitHub issueWhich @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:
- Created 2 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top GitHub Comments
Closing since it looks like you’re trying to import a private API.
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.