Describe the bug
When I try to execute graphql-codegen, windows 10 says it doesn't know what it is. I'm willing to believe it's something I'm doing (or not doing), but I think I followed the instructions for installation.
To Reproduce
I go to an empty directory, type 'yarn init' and initialize a project. Then I type 'yarn -D graphql @graphql-codegen/cli'. Both commands appear to terminate normally and install a bunch of stuff.
Here's the resulting package.json
{
"name": "search-gql",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@graphql-codegen/cli": "^1.7.0",
"graphql": "^14.5.4"
}
}
Then I type: 'graphql-codegen init" and Windows 10 says ''graphql-codegen' is not recognized as an internal or external command, operable program or batch file.'
Can someone tell me what I missed?
# Put your schema here
# Put your operations here
codegen.yml config file:# Put your YML here
Expected behavior
Environment:
@graphql-codegen/...: Additional context
Could you try ‘yarn graphql-codegen init’
That does seem to work.
@Smitty010
You installed the CLI as local dev of your project, it means you should run it from yarn as yarn graphql-codegen, or, with npx.
The best solution is to create a NPM script that runs graphql-codegen, and then to use that script.
If that doesn't work, please share a repo with a reproduction.
Most helpful comment
@Smitty010
You installed the CLI as local dev of your project, it means you should run it from yarn as
yarn graphql-codegen, or, with npx.The best solution is to create a NPM script that runs
graphql-codegen, and then to use that script.If that doesn't work, please share a repo with a reproduction.