Reputation: 99
I am using apollo in my angular 10 and I have this problem after running ng serve
ERROR in The target entry-point "apollo-angular" has missing dependencies:
- @angular/core
- apollo-client
- rxjs
- rxjs/operators
- apollo-link
Is there a command to install all this missing dependencies in my project...even though I think I have installed all these..strange that I have these errors. Can someone shine some wisdom in me,thank you in advance
Upvotes: 4
Views: 6874
Reputation: 11
checkout this : https://apollo-angular.com/docs/get-started
npm install apollo-angular @apollo/client graphql
Upvotes: 1
Reputation: 102457
From the apollo-angular#installation doc:
If you are using Apollo-Client v3, please make sure to use apollo-angular@v2
If you are using Apollo-Client v2, please make sure to use apollo-angular@v1 (and for Angular 10 support, make sure to use v1.10.0)
I am using angular v11.0.3
. After downgrade apollo-angular
to v1.10.0
. Compiled successfully.
Remove apollo-angular
v2.
npm rm apollo-angular -S
Install [email protected]
:
npm i [email protected] -S
package.json
:
"dependencies": {
"@angular/animations": "~11.0.3",
"@angular/common": "~11.0.3",
"@angular/compiler": "~11.0.3",
"@angular/core": "~11.0.3",
"@angular/forms": "~11.0.3",
"@angular/platform-browser": "~11.0.3",
"@angular/platform-browser-dynamic": "~11.0.3",
"@angular/router": "~11.0.3",
"apollo-angular": "^1.10.0",
"apollo-angular-link-http": "^1.11.0",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-error": "^1.1.13",
"detect-browser": "^5.2.0",
"graphql": "^15.4.0",
"graphql-codegen-add": "^0.18.2",
"graphql-tag": "^2.11.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
Upvotes: 3
Reputation: 61
I had the same issue for '@apollo/client/core'
ERROR in The target entry-point "apollo-angular" has missing dependencies:
@apollo/client/core
The import from "@apollo/client/core" in apollo.d.ts didn't work properly. Downgrading apollo-angular to 1.10.0 solved the issue. The documentation says it has the support for Angular 10. The import in apollo.d.ts in this version looks like below:
import { ApolloClient, QueryOptions, MutationOptions, ApolloQueryResult, SubscriptionOptions, ApolloClientOptions } from 'apollo-client';
This is how the dependencies in my package.json look like:
"apollo-angular": "^1.10.0",
"apollo-angular-link-http": "^1.11.0",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"graphql": "^15.1.0",
"graphql-tag": "^2.10.4",
Upvotes: 6
Reputation: 23
I just had the same issue. Angular 10 doesn't play well with Apollo. Reverting to a previous Angular version should fix it.
You can change your angular version in package.json to something like
"dependencies": {
"@angular/animations": "~9.1.7",
"@angular/common": "~9.1.7",
"@angular/compiler": "~9.1.7",
"@angular/core": "~9.1.7",
"@angular/forms": "~9.1.7",
"@angular/platform-browser": "~9.1.7",
"@angular/platform-browser-dynamic": "~9.1.7",
"@angular/router": "~9.1.7"
or whichever you prefer as long it's before Angular 10.
After that delete package-lock.json, delete the node_module and execute
npm i
Upvotes: 2