当我尝试进行一些gql查询时,我会得到这个错误:

我已经尝试更改了角版本,但是我需要在这个版本中实现gql。不升级:/
package.json
{
"dependencies": {
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.10",
"@angular/compiler": "^5.2.10",
"@angular/core": "^5.2.10",
...
"rxjs": "^5.5.9",
"zone.js": "^0.8.26",
"apollo-angular": "^1.0.1",
"apollo-angular-link-http": "^1.0.2-beta.0",
"apollo-cache-inmemory": "^1.1.5",
"apollo-client": "^2.2.0",
"graphql": "^0.12.3",
"graphql-tag": "^2.6.1"
},
"devDependencies": {
"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "^5.2.10",
"@types/node": "^9.6.6",
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"typescript": "^2.8.3"
}
}app.module.ts
...
import { ApolloModule, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
@NgModule({
imports: [
...
HttpClientModule,
ApolloModule,
HttpLinkModule
],
..
})
export class AppModule {
constructor(
apollo: Apollo,
httpLink: HttpLink
) {
apollo.create({
link: httpLink.create({ uri: 'https://graphqlzero.almansi.me/api'}),
cache: new InMemoryCache()
});
}
}我怎么才能解决这个问题?
发布于 2022-05-07 09:04:36
我通过将apollo-cache-inmemory从1.1.5升级到1.3.0来解决这个问题。
https://stackoverflow.com/questions/72148024
复制相似问题