graphql-codegen 未与配置文件一起运行 [英] graphql-codegen not running with config file

查看:25
本文介绍了graphql-codegen 未与配置文件一起运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 package.json 文件中,我有运行 graphql-codegen 的脚本条目,但它抱怨 --config 参数无效:

In my package.json file I've got script entry that runs graphql-codegen but it complains that the --config argument is invalid:

$> yarn gen
yarn run v1.21.1
$ graphql-codegen --config codegen.yml
Error: Unknown argument: config
...
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

因为我相信默认文件名是 codegen.yml 无论如何,我尝试在没有该参数的情况下运行它并且没有生成任何内容:

Since I believe the default file name is codegen.yml anyway, I try to run it with out that argument and nothing gets generated:

$> yarn graphql-codegen
yarn run v1.21.1
$ /home/aaron/projects/my_app/node_modules/.bin/graphql-codegen
Done in 0.17s.

有什么想法吗?

推荐答案

好吧,我不确定我到底做了什么来解决这个问题.我相信我还全局安装了 graphql-codegen 并尝试使用 sudo npm uninstall graphql-codegen 卸载它,它删除了一堆软件包但可执行文件仍然存在:

Ok, I'm not sure exactly what I did to fix this. I believe that I had also installed graphql-codegen globally and tried to uninstall it with sudo npm uninstall graphql-codegen which removed a bunch of packages but the executable still exists:

$>which graphql-codegen
/usr/bin/graphql-codegen

但是我决定一时兴起运行 yarn graphql-codegen init 以查看 init 是否有效,因为我不记得我是否没有尝试过已经.我得到了像往常一样的设置问题,所以我 ctrl+C'ed 并运行 yarn graphql-codegen 并且它起作用了!然后我运行 yarn graphql-codegen --watch 来测试它是否有选项并且也有效.

However I decided to run yarn graphql-codegen init on a whim to see if init was valid and because I couldn't remember if I hadn't tried that already. I got the set up questions like normal so I ctrl+C'ed and just ran yarn graphql-codegen and it worked! Then I ran yarn graphql-codegen --watch to test that it took options and that also worked.

如果有人遇到这个问题,我希望这些提示对您有所帮助.

If anyone gets this issue, I hope these tips help you.

这篇关于graphql-codegen 未与配置文件一起运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆