1
votes

I'm getting this error when I install angular material on my project:

Uncaught TypeError: Object(...) is not a function at bidi.es5.js:87 at Object../node_modules/@angular/cdk/esm5/bidi.es5.js (bidi.es5.js:89) at webpack_require (bootstrap:76) at Object../node_modules/@angular/material/esm5/core.es5.js (http.js:2764) at webpack_require (bootstrap:76) at Object../node_modules/@angular/material/esm5/toolbar.es5.js (core.es5.js:2769) at webpack_require (bootstrap:76) at Object../src/app/content/content.module.ts (content.component.ts:8) at webpack_require (bootstrap:76) at Object../src/app/app.module.ts (app.component.ts:8)

My package.json is the following

{
  "name": "camaleonmanager",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --extract-css",
    "build:ssr": "npm run build -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.2",
    "@angular/cdk": "^6.4.4",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^6.4.4",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/platform-server": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0",
    "angular-font-awesome": "^3.1.2",
    "angular2-jwt": "^0.2.3",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^4.1.3",
    "core-js": "^2.5.7",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.7.2",
    "@angular/cli": "^6.1.2",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "^2.8.8",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.116",
    "codelyzer": "^4.4.3",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.5",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

Seems that I there are some dependencies errors.... But I can't understand which are the libraries involved.... I'm using angular-jwt2 and I think that package is not compatible with @angular/core 6....

If you know what are the problem, I'll thank you if you say me how can I detect in the future dependencies problems.

Thanks a lot, Regards

1
You're mixing several versions of angular modules. Don't. And material 6 requires angular 6, AFAIK. - JB Nizet

1 Answers

0
votes

Finally, I found a solution. There's no native tool to update all packages to the lastest version, so it's needed npm-check-updates. Using ncu -u the package.json file will be updated with the lastest version of each package. Once the previous command has finished, use npm install to update the packages.

In my case, I needed yo install rxjs-compat, executing npm install rxjs@6 rxjs-compat@6 --save.