在我的package.json文件中,我获得了运行graphql-codegen的脚本条目,但是它抱怨--config参数无效:
$> 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,所以我尝试不使用该参数来运行它,而不会生成任何内容:
$> yarn graphql-codegen
yarn run v1.21.1
$ /home/aaron/projects/my_app/node_modules/.bin/graphql-codegen
Done in 0.17s.有什么想法吗?
发布于 2020-02-14 18:20:05
好吧,我不知道我到底做了什么来解决这个问题。我相信我也在全局上安装了graphql-codegen,并尝试用sudo npm uninstall graphql-codegen卸载它,它删除了一堆包,但可执行文件仍然存在:
$>which graphql-codegen
/usr/bin/graphql-codegen然而,我决定运行yarn graphql-codegen init只是一时兴起,看看init是否有效,因为我不记得我是否已经尝试过了。我得到了像普通一样的设置问题,所以我编写了ctrl+C并运行了yarn graphql-codegen,它成功了!然后我运行yarn graphql-codegen --watch来测试它是否使用了选项,这也是有效的。
如果有人知道这个问题,我希望这些建议能帮到你。
发布于 2020-08-18 08:05:46
发布于 2021-04-04 18:34:02
试一试:rm -rf ./node_modules && npm install
rm http://manpages.ubuntu.com/manpages/trusty/man1/rm.1.html
删除文件或目录 -f --强制忽略不存在的文件和参数,永远不要提示 -r,-R,-递归递归删除目录及其内容
node_modules https://docs.npmjs.com/cli/v7/configuring-npm/folders
您可以将node_modules文件夹看作是项目所依赖的外部模块的缓存。当您安装npm时,它们将从web下载并复制到node_modules文件夹中,并且在导入它们时(没有特定路径),nodejs会被训练在那里查找它们。
npm安装 https://docs.npmjs.com/cli/install/
此命令安装包和它所依赖的任何包。如果包有一个包锁,或一个npm收缩包文件,或者一个纱线锁文件,则依赖项的安装将由该文件驱动,并遵循以下优先顺序:
https://stackoverflow.com/questions/60218757
复制相似问题