When I run the command apollo client:codegen
the following error comes up :
Error: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule'
Require stack:
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistcompositionvalidatepreNormalizationtagDirective.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistcompositionvalidatepreNormalizationindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistcompositionvalidateindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistcompositioncomposeAndValidate.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistcompositionindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@apo
llofederationdistindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modulesapol
lo-language-serverlibprovidersschemafile.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modulesapol
lo-language-serverlibprovidersschemaindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modulesapol
lo-language-serverlibprojectbase.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modulesapol
lo-language-serverlibindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollolibcommandsclie
ntcodegen.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@ocl
ifconfiglibplugin.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@ocl
ifconfiglibconfig.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@ocl
ifconfiglibindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@ocl
ifcommandlibcommand.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollonode_modules@ocl
ifcommandlibindex.js
- C:UsersMinseoAppDataRoamingnpmnode_modulesapollobinrun
Code: MODULE_NOT_FOUND
8 Answers
Downgrading does not help. But installing graphql globally seem to solve the issue.
npm install -g graphql
2
-
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
– Community
BotMar 20, 2022 at 0:37
-
2
Does it work if you install it in the repo? some people like to avoid global installs
– jcollumOct 21, 2022 at 21:21
This is a known issue with apollo
. I followed the suggestion to downgrade to node
v14.17.5
, and everything worked.
1
-
That's works for me as well
– AzharMar 8 at 13:50
Very annoying issue, I installed graphql and apollo globally using node v 14. At the end this worked for me: https://github.com/apollographql/apollo-tooling/issues/2415#issuecomment-930173053
Now it works with node v 16 and w/o post install. 🤷♂️
I’ve tried on a windows PC instead of mac with following versions
apollo/2.34.0 win32-x64 node-v10.15.3
That worked for me
1
-
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
– Community
BotJun 3, 2022 at 14:18