Angular 15 ng serve错误,带有ANIMATION_MODULE_TYPE。

3
正如标题所示。我已经为这个错误苦苦挣扎了数小时。 当我尝试ng serve时,大约有30个文件会打印出这个错误:
./node_modules/@angular/material/fesm2020/button.mjs:239:156-177 - Error: export 'ANIMATION_MODULE_TYPE' (imported as 'ANIMATION_MODULE_TYPE') was not found in '@angular/platform-browser/animations' (possible exports: BrowserAnimationsModule, N
oopAnimationsModule, provideAnimations, provideNoopAnimations, ɵAnimationRenderer, ɵAnimationRendererFactory, ɵBrowserAnimationBuilder, ɵBrowserAnimationFactory, ɵInjectableAnimationEngine)

{
  "name": "ProjectName",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "test": "ng test",
    "start": "ng serve --port 4321 --host 0.0.0.0 --configuration develop --disable-host-check true ",
    "build": "ng build --configuration production --cross-origin 'use-credentials' --output-path './dist' --progress=false --source-map=false --delete-output-path=true",
    "build.demo": "ng build --configuration demo --cross-origin 'use-credentials' --output-path './dist' --progress=false --source-map=false --delete-output-path=true",
    "docker-build": "docker build -f dockerFiles/Dockerfile -t OF_AT .",
    "setBuildTime": "date -u +\"%s\" > src/assets/timestamp.txt",
    "tailwind": "npx tailwindcss -i ./src/styles/styles.css -o ../dist/styles.css --watch",
    "lint": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "15.2.4",
    "@angular/animations": "15.2.4",
    "@angular/cdk": "15.2.4",
    "@angular/common": "15.2.4",
    "@angular/compiler": "15.2.4",
    "@angular/core": "15.2.4",
    "@angular/forms": "15.2.4",
    "@angular/material": "15.2.4",
    "@angular/platform-browser": "15.2.4",
    "@angular/platform-browser-dynamic": "15.2.4",
    "@angular/platform-server": "15.2.4",
    "@angular/router": "15.2.4",
    "@material-design-icons/font": "0.14.2",
    "@ngx-translate/core": "14.0.0",
    "@ngx-translate/http-loader": "7.0.0",
    "date-fns": "2.29.3",
    "file-saver": "2.0.5",
    "http-server": "14.1.1",
    "material-design-icons": "3.0.1",
    "messageformat": "2.3.0",
    "ngx-image-cropper": "6.3.2",
    "ng-gallery": "8.0.3",
    "ngx-toastr": "16.0.2",
    "ngx-translate-messageformat-compiler": "6.2.0",
    "ngx-translate-multi-http-loader": "3.0.0",
    "ngx-webstorage-service": "5.0.0",
    "rxjs": "7.8.0",
    "rxjs-compat": "6.6.7",
    "sass": "1.57.1",
    "tslib": "2.4.1",
    "zone.js": "0.11.8"
  },
  "devDependencies": {
    "@angular-eslint/builder": "15.2.1",
    "@angular-eslint/eslint-plugin": "15.2.1",
    "@angular-eslint/eslint-plugin-template": "15.2.1",
    "@angular-eslint/schematics": "15.2.1",
    "@angular-eslint/template-parser": "15.2.1",
    "@angular/cli": "15.2.4",
    "@angular/compiler-cli": "15.2.4",
    "@angular/language-service": "15.2.4",
    "@types/file-saver": "2.0.5",
    "@types/jasmine": "3.10.7",
    "@types/jasminewd2": "2.0.10",
    "@types/node": "12.20.55",
    "@typescript-eslint/eslint-plugin": "5.48.2",
    "@typescript-eslint/parser": "5.48.2",
    "eslint": "8.36.0",
    "eslint-config-prettier": "8.8.0",
    "jasmine-browser-runner": "1.3.0",
    "jasmine-core": "4.5.0",
    "karma": "6.4.1",
    "karma-chrome-launcher": "3.1.1",
    "karma-coverage": "2.2.0",
    "karma-jasmine": "4.0.2",
    "karma-jasmine-html-reporter": "1.7.0",
    "prettier": "2.5.1",
    "tailwindcss": "3.2.4",
    "ts-node": "7.0.1",
    "typescript": "4.9.4"
  },
  "browser": {
    "crypto": false
  }
}

我尝试在应用程序模块中添加noopanimationsmodule,清除缓存,重启编辑器,删除node_modules并重新安装,检查包文件。但是这些解决方案的任何组合都没有起作用。


1
我们在一个 Angular 14 项目上开始遇到这个错误...但只在新的开发者机器上出现。你找到根本原因/解决方案了吗? - undefined
1个回答

2
这个帮助我解决了同样的问题:
ng cache disable


ng cache off

And after that

ng serve

希望能有所帮助!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接