kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 310 forks source link

ERROR in The target entry-point "apollo-angular" has missing dependencies: - @apollo/client/core #1538

Closed ealejandromt closed 4 years ago

ealejandromt commented 4 years ago

Describe the bug

Just updated to new version and brings the error after build:

ERROR in The target entry-point "apollo-angular" has missing dependencies:

To Reproduce Steps to reproduce the behavior:

Install last version (2.0.2) and try to build it

Expected behavior

It should build the application

Environment:

kamilkisiela commented 4 years ago

Works for me.

Could you share your package.json or at least versions of @angular/core, @angular/cli and @apollo/client?

I did:

ng new app
ng add apollo-angular

Then added few components and it builds a production output without any issues.

phani17c commented 4 years ago

I too having the similar issue Here are my versions: "@angular/core": "10.0.8", "apollo-angular": "2.0.3", "@angular/cli": "10.0.5",

kugelvlitz commented 4 years ago

I had a very similar issue and spent way too much time looking for a fix. Turns out the latest Angular release doesn't play well with Apollo. I had to revert to Angular 9.1.10 for it to work.

kamilkisiela commented 4 years ago

@kugelvlitz @phani17c could you share a minimal reproduction, something I could take a look at? I can't guess what's your angular-cli.json looks like or package.json or tsconfig etc

phani17c commented 4 years ago

My issue got fixed with adding apollo-graphql 0.5.0v in my package.json explicitly.

kamilkisiela commented 4 years ago

@phani17c I'm not sure it's the solution, there is something either to fix in angular or apollo. Installing a package doesn't seem like a right workaround.

danielehrhardt commented 4 years ago

i have the same Issue

After i run: npm install @apollo/client apollo-angular graphql

and added the following to the tsconfig.ts: "esModuleInterop": true,

and changed ApolloModuleto Apollo.

it worked

sarora2073 commented 4 years ago

Same issue here, and above steps from @danielehrhardt didn't resolve it for me. I do notice that ApolloModule is no longer a valid export, as shown in the attached. I was previously importing both ApolloModule and Apollo from apollo-angular. Any ideas?

2020-08-12_11-50-27

kamilkisiela commented 4 years ago

@sarora2073 please take a look at https://apollo-angular.com/docs/migration/#no-ngmodules

sarora2073 commented 4 years ago

@kamilkisiela Thanks for that! Went through all the changes in detail (removing http-link packages, and apollo-cache-inmemory), changed code to import from graphql-tag from apollo-angular etc. etc. Unfortunately still getting that same pesky error.

This started when I installed the latest apollo-client 2.6.10 while i was upgrading from ng9 to ng10. I notice now that the InMemoryCache import also fails for similar reasons... typescript doesn't recognize the @apollo/client/core package as shown in screenshot. Was there a new @types package for apollo-angular release? Or maybe this is a bug?

image

kamilkisiela commented 4 years ago

@sarora2073 do you have @apollo/client package installed?

sarora2073 commented 4 years ago

Sorry just realized that was the issue. I've migrated to @apollo/client. Thank you!

kamilkisiela commented 4 years ago

I asked for a reproduction or some clues, no answers so I'm closing this one.

Splaktar commented 4 years ago

Shouldn't the ng update migration remove the ApolloModule and the HttpLinkModule?

kugelvlitz commented 4 years ago

I asked for a reproduction or some clues, no answers so I'm closing this one.

My imports looked like this

import { Apollo } from "apollo-angular";

And before downgrading angular package.json was

  "dependencies": {
    "@angular/animations": "~10.0.6",
    "@angular/animations": "~9.1.7",
    "@angular/common": "~10.0.6",
    "@angular/common": "~9.1.7",
    "@angular/compiler": "~10.0.6",
    "@angular/compiler": "~9.1.7",
    "@angular/core": "~10.0.6",
    "@angular/core": "~9.1.7",
    "@angular/forms": "~10.0.6",
    "@angular/forms": "~9.1.7",
    "@angular/platform-browser": "~10.0.6",
    "@angular/platform-browser": "~9.1.7",
    "@angular/platform-browser-dynamic": "~10.0.6",
    "@angular/platform-browser-dynamic": "~9.1.7",
    "@angular/router": "~10.0.6",
    "@angular/router": "~9.1.7",
    "rxjs": "~6.5.5",
    "angular": "^1.8.0",
    "tslib": "^2.0.0",
    "apollo-angular": "^1.10.0",
    "zone.js": "~0.10.3"

After downgrading

 "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",
    "angular": "^1.8.0",
    "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",
    "express": "^4.17.1",
    "graphql": "^15.3.0",
    "graphql-tag": "^2.10.4",
    "js-base64": "^3.3.2",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "typescript": "~3.8.3",
    "zone.js": "~0.10.2"

package.json with angular/cli 10 is missing apollo dependencies because i took them out when they were failing, but they were both identical. My error message was similar to @ealejandromt 's.

sarora2073 commented 4 years ago

if you're using apollo-client (which apparently you are in the package.json above) you're going to run into the same issues I did, which were asked and addressed above. You have to install @apollo/client (new package) and read the migration guide above.