如何将 Angular 项目版本从 12.2.5 降级到 12.2.1?

How to downgrade Angular project version from 12.2.5 to 12.2.1?

我有一个 Angular 版本为 12.2.5 的项目。我们正在使用微前端架构。所有其他 Angular 项目都使用版本 12.2.1。我的项目使用的是 12.2.5。一些 css 和动画无法正常工作。有没有办法将其降级到 12.2.1。我的 pacakage.json 文件在下面。

{
  "name": "xyz",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
  },
  "private": true,
  "dependencies": {
    "@angular-architects/module-federation": "^12.5.0",
    "@angular-architects/module-federation-runtime": "^12.5.0",
    "@angular/animations": "12.2.5",
    "@angular/common": "^12.2.6",
    "@angular/compiler": "12.2.5",
    "@angular/core": "^12.2.6",
    "@angular/forms": "^12.2.6",
    "@angular/platform-browser": "12.2.5",
    "@angular/platform-browser-dynamic": "12.2.5",
    "@angular/platform-server": "12.2.5",
    "@angular/router": "^12.2.6",
    "@nguniversal/module-map-ngfactory-loader": "8.1.1",
    "@ngx-translate/core": "^13.0.0",
    "file-saver": "^2.0.5",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "raleway-webfont": "^3.0.1",
    "rxjs": "^6.6.3",
    "tslib": "^2.0.0",
    "xlsx": "^0.17.3",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^12.1.2",
    "@angular-devkit/build-angular": "~12.2.5",
    "@angular-eslint/builder": "12.4.1",
    "@angular-eslint/eslint-plugin": "12.4.1",
    "@angular-eslint/eslint-plugin-template": "12.4.1",
    "@angular-eslint/schematics": "12.4.1",
    "@angular-eslint/template-parser": "12.4.1",
    "@angular/cli": "^12.2.5",
    "@angular/compiler-cli": "^12.2.5",
    "@angular/language-service": "^12.2.5",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.28.2",
    "@typescript-eslint/parser": "4.28.2",
    "codelyzer": "^6.0.0",
    "eslint": "^7.32.0",
    "html-webpack-plugin": "^5.5.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "typescript": "4.3.5",
    "webpack": "^5.52.1"
  },
  "optionalDependencies": {
    "protractor": "~7.0.0",
    "ts-node": "~8.4.1"
  },
  "resolutions": {
    "webpack": "^5.0.0"
  }
}

1-您必须清除 node_modules 文件夹(如果可以请备份)

2-在 package.json 文件中为所有 angular 包指定您想要的版本号

  "@angular/cli": "12.2.1"

3- 运行 npm 安装命令