Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't read tsconfig.base.json! - Apollo Angular project setup

ng add apollo-angular

It threw a number of warnings:

UPDATE src/app/app.module.ts (541 bytes)
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10.17.0 || ^12.0.0 || >= 13.7.0"} (current: {"node":"10.16.3","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN [email protected] requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of subscriptions-transport-ws@^0.9.0 but none is installed. You must install peer dependencies yourself.

So after adding the peer dependencies I try to add apollo-angular one more time:

MIA-LT-16354:src SSilwal$ ng add apollo-angular
Skipping installation: Package already installed
? Url to your GraphQL endpoint https://o5x5jzoo7z.sse.codesandbox.io/graphql'
Couldn't read tsconfig.base.json!

Environment:

@apollo/client: 3.0.0 apollo-angular:2.0.3 graphql:15.3.0 @angular/core:9.1.7 @angular/cli: 9.1.12 typescript:3.8.3

like image 624
ShrawaniSilwal Avatar asked Nov 07 '22 05:11

ShrawaniSilwal


1 Answers

This issue usually happens when your Angular project had a version migration before, so that the tsconfig.base.json is missing or not valid.

You can try installing apollo-angular manually as the official document guides itself

Apollo Angular official guide on installing apollo-angular without Angular schematics

or follow this manual updates I mention below:


The Github issue raised by the author of the question offers a fix by only updating the angular version, try this first

During the time I was facing this problem using the command below had helped some people but didn't solve mine

it's free to try

ng update @angular/cli --migrate-only --from 9 --to 10
ng update @angular/core --migrate-only --from 9 --to 10

or try using --force if you faced errors (Use With Caution !!)

It's the solution offered to fix tsconfig.base.json problems caused by migrating Angular version

Main Source : Github issue related to this question

Note that it has some side effects

Read more at Angulars Official Docs about how to migrate properly based of how complex your project is


I personally used this command to install all packages needed and proceeded with the guide to add needed modules.

ng update apollo-angular --migrate-only --from 1.10.0

or try using --force if you faced errors (Use With Caution !!)

ng update apollo-angular --migrate-only --from 1.10.0 --force

I hope this helped :)

P.S in some countries such as Iran, you might need to use a proxy to use ng add apollo-angular

like image 81
Farhad Avatar answered Nov 15 '22 10:11

Farhad