tomastrajan / angular-ngrx-material-starter

Angular, NgRx, Angular CLI & Angular Material Starter Project
https://tomastrajan.github.io/angular-ngrx-material-starter
MIT License
2.82k stars 918 forks source link

Cannot integrate Apollo Angular #453

Closed jatin-chauhan closed 5 years ago

jatin-chauhan commented 5 years ago

Hi i am trying to integrate Apollo Angular to this project and getting errors. I need help to integrate it, please help me:

I cloned the boilerplate code and run ng add apollo-angular from the installation guide given below-- Apollo Angular installation guide -: https://www.apollographql.com/docs/angular/basics/setup.html#installation

Error screenshot goes below image

Thank you in advance for the help.

anthowm commented 5 years ago

Hello, try to follow without Angular Schematics. I try with it and i get same erros but with manual installation it work for me.

jatin-chauhan commented 5 years ago

@anthowm Thanks for replying fast. I tried it without angular schematics and installed each package separately. After installation i injected the imports in App module and then at the time of running the project i get same compilation errors.

tomastrajan commented 5 years ago

@anthowm @jatin-chauhan errors seems to be coming from apollo only, maybe you can have a look if you have to add appolo to types of tsconfig compiler options? or is there a version mis-match?

anthowm commented 5 years ago

I share you my dependencies maybe you don't install the graphql types, remember too add "esnext.asynciterable" in you tsconfig Dependencies

"dependencies": {
    "@angular/animations": "^7.2.0",
    "@angular/cdk": "^7.2.1",
    "@angular/common": "^7.0.2",
    "@angular/compiler": "^7.0.2",
    "@angular/core": "^7.0.2",
    "@angular/forms": "^7.0.2",
    "@angular/http": "^7.0.2",
    "@angular/material": "^7.0.3",
    "@angular/platform-browser": "^7.0.2",
    "@angular/platform-browser-dynamic": "^7.0.2",
    "@angular/router": "^7.0.2",
    "@auth0/angular-jwt": "^2.1.0",
    "@fortawesome/angular-fontawesome": "^0.3.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.8",
    "@fortawesome/free-brands-svg-icons": "^5.5.0",
    "@fortawesome/free-regular-svg-icons": "^5.5.0",
    "@fortawesome/free-solid-svg-icons": "^5.5.0",
    "@ngrx/effects": "^6.1.2",
    "@ngrx/entity": "^6.1.2",
    "@ngrx/router-store": "^6.1.2",
    "@ngrx/store": "^6.1.2",
    "@ngrx/store-devtools": "^6.1.2",
    "@ngx-gallery/core": "^4.0.1",
    "@ngx-gallery/gallerize": "^4.0.1",
    "@ngx-gallery/lightbox": "^4.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "apollo-angular": "^1.5.0",
    "apollo-angular-link-http": "^1.4.0",
    "apollo-cache-inmemory": "^1.3.12",
    "apollo-client": "^2.4.8",
    "apollo-link": "^1.2.6",
    "apollo-link-context": "^1.0.12",
    "apollo-link-error": "^1.1.5",
    "apollo-upload-client": "^10.0.0",
    "bootstrap": "^4.1.3",
    "browser-detect": "^0.2.28",
    "core-js": "^2.5.4",
    "graphql": "^14.0.2",
    "graphql-tag": "^2.10.0",
    "hammerjs": "^2.0.8",
    "ngx-infinite-scroll": "^7.0.1",
    "ngx-material-file-input": "^0.3.0",
    "rxjs": "^6.3.3",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "~7.0.4",
    "@angular/compiler-cli": "^7.0.2",
    "@angular/language-service": "^7.0.2",
    "@bahmutov/add-typescript-to-cypress": "^2.0.0",
    "@compodoc/compodoc": "^1.1.7",
    "@types/apollo-upload-client": "^8.1.1",
    "@types/graphql": "^14.0.4",
    "@types/jest": "^23.3.10",
    "@types/jasmine": "~2.8.9",
    "@types/jasminewd2": "^2.0.5",
    "@types/node": "^8.9.5",
    "codelyzer": "~4.2.1",
    "cypress": "^3.1.3",
    "graphql-code-generator": "^0.15.2",
    "graphql-codegen-introspection": "^0.15.2",
    "graphql-codegen-typescript-apollo-angular": "^0.15.2",
    "graphql-codegen-typescript-client": "^0.15.2",
    "graphql-codegen-typescript-common": "^0.15.2",
    "jasmine-core": "~3.2.1",
    "jasmine-marbles": "^0.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.4",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "~1.3.1",
    "karma-spec-reporter": "~0.0.32",
    "ngrx-store-freeze": "^0.2.4",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~3.1.6"
  }

TSCONFIG

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./src",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom",
      "esnext.asynciterable"
    ],
    "paths": {
      "@app/*": [
        "app/*"
      ],
      "@env/*": [
        "environments/*"
      ],
      "@testing/*": [
        "testing/*"
      ],
      "@app-pets-store/*": [
        "app/pets/store/*"
      ]
    }
  }
}
jatin-chauhan commented 5 years ago

@anthowm Thanks for the solution. It worked with your mentioned dependencies. Looks like I was missing graphql types. But I also have one more package apollo-link-ws . Installing and importing it gives me below error-- ERROR in node_modules/apollo-link-ws/lib/webSocketLink.d.ts(6,19): error TS2709: Cannot use namespace 'ClientOptions' as a type. node_modules/apollo-link-ws/lib/webSocketLink.d.ts(13,63): error TS2709: Cannot use namespace 'SubscriptionClient' as a type.

jatin-chauhan commented 5 years ago

@anthowm Thanks for all the help, i got that working.:)

anthowm commented 5 years ago

perfect :)

tomastrajan commented 5 years ago

@anthowm @jatin-chauhan great! So this is finished then, right ?

ramax495 commented 5 years ago

@jatin-chauhan Could you describe in details what did you do to integrate Apollo Angular ? Maybe list of actions you have done.

jatin-chauhan commented 5 years ago

@tomastrajan Yes this is finished. You can close this. :)

jatin-chauhan commented 5 years ago

@ramax495 I followed the tutorial to integrate it- https://www.apollographql.com/docs/angular/basics/setup.html#installation I was missing graphql types but adding those fixed the issue.

tomastrajan commented 5 years ago

Solution was found. ( Old issue cleanup )