TypeError: Object(…) is not a function at eval (platform.es5.js:79) at eval (platform.es5.js:81)

后端 未结 7 1245
醉梦人生
醉梦人生 2021-02-05 10:52

I am getting the following error :

platform.es5.js:79 Uncaught TypeError: Object(...) is not a function
    at eval (platform.es5.js:79)
    at eval (platform.es         


        
相关标签:
7条回答
  • 2021-02-05 11:03

    That works for me. I changed them to the follows:

    "@angular/animations": "^7.2.10"

    "@angular/cdk": "^7.3.1"

    "@angular/material": "^7.3.7"

    Using:

    • npm install @angular/animations@7.2.10
    • npm install @angular/cdk@7.3.1
    • npm install @angular/material@7.3.7

    After that I enter: npm i

    And the issue was fixed

    0 讨论(0)
  • 2021-02-05 11:12

    The reason of behind this, your current angularCLI version and you're current angular/material version & angular/CDK version. Please check it.

    like: Angular CLI version (7.4) and angular/material version(8.1).....so both are not the same path.

    change your angular/material version & angular/cdk version in package.json file.

    Example:- "@angular/material": "7.2.1", "@angular/cdk": "7.2.1", in package.json file.

    After that run this command = npm install

    0 讨论(0)
  • 2021-02-05 11:17

    You can't use @angular/material and @angular/cdk version 6.1.0 since your angular dependencies is still at 5.2.0

    download the version 5.2.0

    npm install @angular/material@5.2.0
    

    And also keep your angular dependencies on a same version, your @angular/animations is at 5.2.11 where it should be 5.2.0

    0 讨论(0)
  • 2021-02-05 11:17
       {
      "name": "my-blog",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "7.2.1",
        "@angular/cdk": "7.2.1",
        "@angular/common": "~7.1.0",
        "@angular/compiler": "~7.1.0",
        "@angular/core": "~7.1.0",
        "@angular/forms": "~7.1.0",
        "@angular/material": "7.2.1",
        "@angular/platform-browser": "~7.1.0",
        "@angular/platform-browser-dynamic": "~7.1.0",
        "@angular/flex-layout": "7.0.0-beta.22",
        "@angular/router": "~7.1.0",
        "core-js": "^2.5.4",
        "rxjs": "~6.3.3",
        "tslib": "^1.9.0",
        "zone.js": "~0.8.26"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.11.0",
        "@angular/cli": "~7.1.1",
        "@angular/compiler-cli": "~7.1.0",
        "@angular/language-service": "~7.1.0",
        "@types/node": "~8.9.4",
        "@types/jasmine": "~2.8.8",
        "@types/jasminewd2": "~2.0.3",
        "codelyzer": "~4.5.0",
        "jasmine-core": "~2.99.1",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~3.1.1",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.1",
        "karma-jasmine": "~1.1.2",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.4.0",
        "ts-node": "~7.0.0",
        "tslint": "~5.11.0",
        "typescript": "~3.1.6"
      }
    }
    

    Make sure "@angular/animations" , "@angular/cdk" and "@angular/material" are in same version .Remove ^ symbole and save package.json . At last do npm install .It will solve the issue.

    0 讨论(0)
  • 2021-02-05 11:19

    After downgraded the flex-layout, It works for me. I have downgraded flex-layout to 7.0.0-beta.24 version

    npm install @angular/flex-layout@7.0.0-beta.24
    

    as I have package.json like below

    "@angular/animations": "~7.2.0",
    "@angular/cdk": "~7.3.7",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/flex-layout": "^7.0.0-beta.24",
    "@angular/forms": "~7.2.0",
    "@angular/material": "^7.3.7",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "core-js": "^2.5.4",
    "hammerjs": "^2.0.8",
    "ngx-device-detector": "^1.3.6",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
    
    0 讨论(0)
  • 2021-02-05 11:20

    I had a similar error message, which appears to be caused by version 8 modules being used with Angular 7. The solution for me was to go through package.json looking for version 8 modules (in my case, @angular/cdk and @angular/material), changing them to the most recent version 7 modules, and then re-running npm i

    0 讨论(0)
提交回复
热议问题