nuxt-graphql-client: Unable to use the package

I am getting an error

ERROR  Cannot start nuxt:  The requested module '@graphql-codegen/plugin-helpers' does not provide an export named 'DetailedError'                                                         12:03:52

  import { DetailedError, createNoopProfiler } from '@graphql-codegen/plugin-helpers';
  ^^^^^^^^^^^^^
  SyntaxError: The requested module '@graphql-codegen/plugin-helpers' does not provide an export named 'DetailedError'
  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
  at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
  at async Promise.all (index 0)
  at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
  at async normalizeModule (node_modules/@nuxt/kit/dist/index.mjs:476:26)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:455:41)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1606:7)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6778:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6828:5)
  at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

I guess it might be because of the recent update to the graphql-code-generator more specifically because of this PR where they have removed the DetailedError

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (7 by maintainers)

Most upvoted comments

@ShreyAmbesh @boboldehampsink Temporary fix:

Context

This error occurs when the .nuxt directory wasn’t generated prior to running nuxi dev or nuxi prepare, the error is due to to ts-node attempting to load the .nuxt/tsconfig.json file which is extended by the project level tsconfig.json file.

1. Modify tsconfig.json - Recommended approach

Temporarily comment out the line below until the .nuxt directory has been generated.

{
//    "extends": "./.nuxt/tsconfig.json"
}

Be sure to remove the comment after the .nuxt directory has been generated.

2. OR Pin Dependencies

Add the following to your package.json file to pin the pertinent dependencies.

For NPM

  "overrides": {
    "@graphql-codegen/cli": "2.13.4",
    "@graphql-codegen/core": "2.6.2",
    "@graphql-codegen/plugin-helpers": "2.7.1"
  }

For Yarn / Pnpm

  "resolutions": {
    "@graphql-codegen/cli": "2.13.4",
    "@graphql-codegen/core": "2.6.2",
    "@graphql-codegen/plugin-helpers": "2.7.1"
  }

maddening

@stlbucket Indeed, this is quite an annoying bug caused by important upstream dependencies that we haven’t been able to get around. As a temporary workaround I might resort to publishing a patched version of the dep to be used solely by this nuxt module that averts this issue.

@talaxasy Second works like a charm

Closing, this was recently resolved upstream as per dotansimha/graphql-code-generator#8590

@Diizzayy - i will be trying this soon - fyi i had been on rc13, then woke up this morning to the release news so have rebuilt on 3.0

nuxt-graphql-client is showing as 0.2.12 in my package.json - above you said 0.2.11?

my next step will be incorporating pinia, which is where i actually encountered the problem previously

I had to blow away my package-lock.json but this update installs and runs smoothly without the need for overrides. Thanks so much for your work on this package!

@ShreyAmbesh @stlbucket @talaxasy @stuible version 0.2.11 has been released with the aforementioned patch. Looking forward to hearing your feedback.

@Diizzayy I’m for it

@Diizzayy’s method No. 1 doesn’t work for me, and the second didn’t try