Apollo-server: 'Response' was also declared here

Created on 4 Jun 2019  ·  1Comment  ·  Source: apollographql/apollo-server

I am trying to run npm run serve but every time I got this error

node_modules/apollo-server-cloud-functions/node_modules/apollo-cache-control/dist/index.d.ts:24:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'cacheControl' must be of type '{ setCacheHint: (hint: CacheHint) => void; cacheHint: CacheHint; }', but here has type '{ setCacheHint: (hint: CacheHint) => void; cacheHint: CacheHint; }'.

24         cacheControl: {
           ~~~~~~~~~~~~

node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:4:16 - error TS2451: Cannot redeclare block-scoped variable 'GraphQLUpload'.

4   export const GraphQLUpload: GraphQLScalarType;
                 ~~~~~~~~~~~~~

  node_modules/apollo-server-core/src/types/graphql-upload.d.ts:4:16
    4   export const GraphQLUpload: GraphQLScalarType;
                     ~~~~~~~~~~~~~
    'GraphQLUpload' was also declared here.

node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:21:15 - error TS2300: Duplicate identifier 'Request'.

21   export type Request = any;
                 ~~~~~~~

  node_modules/apollo-server-core/src/types/graphql-upload.d.ts:21:15
    21   export type Request = any;
                     ~~~~~~~
    'Request' was also declared here.

node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:23:15 - error TS2300: Duplicate identifier 'Response'.

23   export type Response = any;
                 ~~~~~~~~

  node_modules/apollo-server-core/src/types/graphql-upload.d.ts:23:15
    23   export type Response = any;
                     ~~~~~~~~
    'Response' was also declared here.

node_modules/apollo-server-core/src/types/graphql-upload.d.ts:4:16 - error TS2451: Cannot redeclare block-scoped variable 'GraphQLUpload'.

4   export const GraphQLUpload: GraphQLScalarType;
                 ~~~~~~~~~~~~~

  node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:4:16
    4   export const GraphQLUpload: GraphQLScalarType;
                     ~~~~~~~~~~~~~
    'GraphQLUpload' was also declared here.

node_modules/apollo-server-core/src/types/graphql-upload.d.ts:21:15 - error TS2300: Duplicate identifier 'Request'.

21   export type Request = any;
                 ~~~~~~~

  node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:21:15
    21   export type Request = any;
                     ~~~~~~~
    'Request' was also declared here.

node_modules/apollo-server-core/src/types/graphql-upload.d.ts:23:15 - error TS2300: Duplicate identifier 'Response'.

23   export type Response = any;
                 ~~~~~~~~

  node_modules/apollo-server-cloud-functions/node_modules/apollo-server-core/src/types/graphql-upload.d.ts:23:15
    23   export type Response = any;
                     ~~~~~~~~
    'Response' was also declared here.

My tsconfig

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "esModuleInterop": true,
    "strict": true,
    "target": "es2017",
    "lib": [
      "esnext.asynciterable"
    ]
  },
  "compileOnSave": true,
  "include": [
    "src", "index.ts"
  ]
}

Most helpful comment

OK, I have solved.

1 - delete node_modules
2 - delete package-lock.json
3 - npm install

>All comments

OK, I have solved.

1 - delete node_modules
2 - delete package-lock.json
3 - npm install

Was this page helpful?
0 / 5 - 0 ratings