You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi, i'm trying to generate Typescript GraphQL Schema and i used the docs but the 'init' command is not working. I am trying to do all of this in a Next.JS 13 project :
$ npx graphql-code-generator init
/Users/japroz/coding/programming/bid-two-travel/web/node_modules/cliui/build/index.cjs:292
const stripAnsi = require('strip-ansi');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/japroz/coding/programming/bid-two-travel/web/node_modules/strip-ansi/index.js from /Users/japroz/coding/programming/bid-two-travel/web/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /Users/japroz/coding/programming/bid-two-travel/web/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/cliui/build/index.cjs:292:19)
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/yargs/build/index.cjs:1:60678)
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/yargs/index.cjs:5:30)
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/@graphql-codegen/cli/cjs/config.js:15:41)
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/@graphql-codegen/cli/cjs/cli.js:27:21)
at Object.<anonymous> (/Users/japroz/coding/programming/bid-two-travel/web/node_modules/@graphql-codegen/cli/cjs/bin.js:4:18) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v18.19.0
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi, i'm trying to generate Typescript GraphQL Schema and i used the docs but the 'init' command is not working. I am trying to do all of this in a Next.JS 13 project :
My
codegen.yml
file:I have tried so many different methods but none seems to work. This is my package.json
and this is my tsconfig
Beta Was this translation helpful? Give feedback.
All reactions