'Error: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule'
When I run the command apollo client:codegen
the following error comes up :
Error: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule'
Require stack:
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\composition\validate\preNormalization\tagDirective.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\composition\validate\preNormalization\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\composition\validate\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\composition\composeAndValidate.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\composition\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@apo
llo\federation\dist\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\apol
lo-language-server\lib\providers\schema\file.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\apol
lo-language-server\lib\providers\schema\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\apol
lo-language-server\lib\project\base.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\apol
lo-language-server\lib\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\lib\commands\clie
nt\codegen.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@ocl
if\config\lib\plugin.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@ocl
if\config\lib\config.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@ocl
if\config\lib\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@ocl
if\command\lib\command.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\node_modules\@ocl
if\command\lib\index.js
- C:\Users\Minseo\AppData\Roaming\npm\node_modules\apollo\bin\run
Code: MODULE_NOT_FOUND
Solution 1:[1]
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. ????
Solution 2:[2]
You only have to install apollo(yarn add apollo) and fix the problem
Solution 3:[3]
This is a known issue with apollo
. I followed the suggestion to downgrade to node
v14.17.5
, and everything worked.
Solution 4:[4]
Downgrading does not help. But installing graphql globally seem to solve the issue.
npm install -g graphql
Solution 5:[5]
Just install appolo into your dev dependencies, e.g yarn add -D apollo
and use it like ./node_modules/.bin/apollo client:codegen
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sahil Jaidka |
Solution 2 | Lance Kind |
Solution 3 | Heath Borders |
Solution 4 | neeraj tk |
Solution 5 | Georges Feungap |