Gatsby: Error: Cannot create as TypeComposer the following value: Date.

Created on 19 May 2020  ยท  6Comments  ยท  Source: gatsbyjs/gatsby

Hi everyone !

I can't launch my website anymore after installing graphql, and graphql-yoga.
I am using the command gatsby develop

Below is the error i get :

โ ‹ building schema

 ERROR 

UNHANDLED REJECTION Cannot create as TypeComposer the following value: Date.



  Error: Cannot create as TypeComposer the following value: Date.

  - SchemaComposer.js:365 SchemaComposer.createTempTC
    [RealVest]/[graphql-compose]/lib/SchemaComposer.js:365:11

  - SchemaComposer.js:563 SchemaComposer.addAsComposer
    [RealVest]/[graphql-compose]/lib/SchemaComposer.js:563:27

  - schema-composer.js:35 createSchemaComposer
    [RealVest]/[gatsby]/dist/schema/schema-composer.js:35:18

  - index.js:135 Object.build
    [RealVest]/[gatsby]/dist/schema/index.js:135:26

  - index.js:392 async module.exports
    [RealVest]/[gatsby]/dist/bootstrap/index.js:392:3

  - develop.js:439 async module.exports
    [RealVest]/[gatsby]/dist/commands/develop.js:439:7

not finished building schema - 0.186s

I update my graphql dependencies at the same level :

npm list graphql           
[email protected] /Users/Romain/Desktop/Programming/RealVest
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚   โ””โ”€โ”€ [email protected] 
โ”‚ โ””โ”€โ”€ [email protected] 
โ”œโ”€โ”€ [email protected] 
โ””โ”€โ”ฌ [email protected]
  โ”œโ”€โ”ฌ @types/[email protected]
  โ”‚ โ””โ”€โ”€ [email protected]  deduped
  โ””โ”€โ”€ UNMET PEER DEPENDENCY [email protected] 

Gatsby :

  System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.2.0 - /usr/local/bin/node
    npm: 6.14.5 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.138
    Safari: 13.1
  npmPackages:
    gatsby: ^2.21.7 => 2.21.39
    gatsby-image: ^2.4.0 => 2.4.4
    gatsby-plugin-manifest: ^2.4.1 => 2.4.5
    gatsby-plugin-offline: ^3.2.0 => 3.2.3
    gatsby-plugin-react-helmet: ^3.3.0 => 3.3.1
    gatsby-plugin-sass: ^2.3.0 => 2.3.1
    gatsby-plugin-sharp: ^2.6.0 => 2.6.5
    gatsby-plugin-typescript: ^2.4.0 => 2.4.2
    gatsby-source-filesystem: ^2.3.0 => 2.3.4
    gatsby-transformer-sharp: ^2.5.0 => 2.5.2
  npmGlobalPackages:
    gatsby-cli: 2.11.17
    gatsby: 2.20.31

I already tried to delete my node_modules and package-lock.json then to run npm install again but it didn't work...

Does anyone have an idea what it could be?

needs reproduction GraphQL question or discussion

Most helpful comment

Hi @rosanche !

It is most likely a dependency (npm) issue. You still have multiple graphql instances somehow (not deduped by npm).

Usually deleting package-lock.json and updating packages fix this kind of errors. It's weird that it didn't work for you. Can you try installing deps with yarn (just to confirm it is a dependency issue)?

Also, can you share a minimal reproduction? Maybe package.json with some default starter will be enough.

All 6 comments

@rosanche more information would be nice. What is the build output? Where are you getting the error? How are you "launching" your website? What commands are you running? Do you have a repo we can check out?

Also, next time, can you please use triple ticks to paste a block of code? It will format better (I've edited your description accordingly)

cc @vladar @freiksenet for more information.

@pvdz Thanks ! I just updated my post with the informations needed !
Have anyone have an idea how I could solve it ?
I already tried to delete my node_modules and package-lock.json then to run npm install again but it didn't work...

Hi @rosanche !

It is most likely a dependency (npm) issue. You still have multiple graphql instances somehow (not deduped by npm).

Usually deleting package-lock.json and updating packages fix this kind of errors. It's weird that it didn't work for you. Can you try installing deps with yarn (just to confirm it is a dependency issue)?

Also, can you share a minimal reproduction? Maybe package.json with some default starter will be enough.

Thanks @vladar ! I deleted my package-lock and use npm update instead of npm installand it works !

It didnt work for me :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferMartz picture ferMartz  ยท  3Comments

kalinchernev picture kalinchernev  ยท  3Comments

rossPatton picture rossPatton  ยท  3Comments

hobochild picture hobochild  ยท  3Comments

ghost picture ghost  ยท  3Comments