Angular7 ng-zorro-antd version issu

  • Today, I opened the old project and reported an error. It was found that it was a version problem. First upgrade the ts version, then upgrade the angular version, and finally upgrade the ng-zorro-antd version. All the package.json code after the upgrade is as follows:

    {
      "name": "source",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build --configuration=production",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "^7.2.7",
        "@angular/common": "^7.2.7",
        "@angular/compiler": "^7.2.7",
        "@angular/core": "^7.2.7",
        "@angular/forms": "^7.2.7",
        "@angular/http": "^7.2.7",
        "@angular/platform-browser": "^7.2.7",
        "@angular/platform-browser-dynamic": "^7.2.7",
        "@angular/router": "^7.2.7",
        "core-js": "^2.5.4",
        "ng-zorro-antd": "^7.0.0-rc.3",
        "primeicons": "^1.0.0-beta.10",
        "primeng": "^6.1.4",
        "rxjs": "^6.4.0",
        "tslib": "^1.9.0",
        "zone.js": "~0.8.29"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.13.0",
        "@angular/cli": "~7.3.3",
        "@angular/compiler-cli": "^7.2.7",
        "@angular/language-service": "^7.2.7",
        "@types/jasmine": "~2.8.6",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
        "codelyzer": "~4.2.1",
        "jasmine-core": "~2.99.1",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~1.7.1",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.0",
        "karma-jasmine": "~1.1.1",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.4.0",
        "ts-node": "~5.0.1",
        "tslint": "~5.9.1",
        "typescript": "^3.2.4"
      }
    }
    

here is the whole code of angular.json


```
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "source": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/source",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              {
                "glob": "**/*",
                "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
                "output": "/assets/"
              }
            ],
            "styles": [
              "node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
              "node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css",
              "src/styles.css",
              "node_modules/primeicons/primeicons.css",
              "node_modules/primeng/resources/themes/nova-light/theme.css",
              "node_modules/primeng/resources/primeng.min.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "source:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "source:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "source:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
              "node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css",
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "source-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "source:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "source:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "source"
}
```
  • now use the command: ng serve-- open to run the project with the following error

    D:\Java\frontEnd\femis\source>ng serve --open
    ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
    
    Date: 2019-02-27T15:14:54.044Z
    Hash: 9498e00a8db5bee81c1a
    Time: 33716ms
    chunk {main} main.js, main.js.map (main) 1.85 kB [initial] [rendered]
    chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.3 kB [initial] [rendered]
    chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
    chunk {styles} styles.js, styles.js.map (styles) 2.65 MB [initial] [rendered]
    chunk {vendor} vendor.js, vendor.js.map (vendor) 327 kB [initial] [rendered]
    
    WARNING in ./node_modules/ng-zorro-antd/ng-zorro-antd.min.css (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/ng-zorro-antd/ng-zorro-antd.min.css)
    Module Warning (from ./node_modules/postcss-loader/src/index.js):
    Warning
    
    (1:3134) Replace text-decoration-skip: ink to text-decoration-skip-ink: auto, because spec had been changed
    
    WARNING in ./node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css)
    Module Warning (from ./node_modules/postcss-loader/src/index.js):
    Warning
    
    (1:3134) Replace text-decoration-skip: ink to text-decoration-skip-ink: auto, because spec had been changed
    
    ERROR in src/app/shared/service/reflect-util.service.ts(3,10): error TS2305: Module ""D:/Java/frontEnd/femis/source/node_modules/@angular/core/src/render3"" has no exported member "T".

after searching on the Internet, I didn"t find a solution. How to solve this problem?

Jul.14,2022

remove node_modules and reinstall

  • Error in adding ng-zorro-antd to angular7

    create a new project from the command line ng new today-ng then cd today-ng enter the newly created project add ng-zorro-antd via the command ng add ng-zorro-antd the following error occurred: asked the official to modify the sourc...

    Jun.15,2022
Menu