angularangular-flex-layout

Error: Module not found: Error: Package path ./module is not exported from package /node_modules/@angular/flex-layout Flex Layout


I've gone through similar errors in SO but after installing, deleting node-modules, package-lock.json any installing it again, I still can't get rid of the error:

./src/app/app.module.ts:8:0-63 - Error: Module not found: Error: Package path ./module is not exported from package /Users/pabs/FreeLance/Chris/Calculator/stamp/node_modules/@angular/flex-layout (see exports field in /Users/pabs/FreeLance/Chris/Calculator/stamp/node_modules/@angular/flex-layout/package.json)

{
  "name": "stamp",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/cdk": "^13.2.3",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/flex-layout": "^13.0.0-beta.38",
    "@angular/forms": "~13.2.0",
    "@angular/material": "^13.2.3",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "rxjs": "^6.6.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.3",
    "@angular/cli": "~13.2.3",
    "@angular/compiler-cli": "~13.2.0",
    "@types/jasmine": "~3.10.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~4.0.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "typescript": "~4.5.2"
  }
}

Solution

  • Turns out I was doing an auto-import using Visual Studio Code and it generates the wrong path :

    incorrect one: import { FlexLayoutModule } from '@angular/flex-layout/module';

    correct one: instead of import { FlexLayoutModule } from '@angular/flex-layout';