cjoudrey / graphql-schema-linter

Validate GraphQL schema definitions against a set of rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: nodes.flatMap is not a function

sowens01 opened this issue · comments

Not quite sure if this is a code error or a user error. I installed graphql-schema-linter and graphql globally using npm per the installation instructions. When I try to run graphql-schema-linter on any schema file, I get the following error:

TypeError: nodes.flatMap is not a function
at buildInterfaces (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\utilities\extendSchema.js:605:18)
at interfaces (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\utilities\extendSchema.js:671:29)
at resolveReadonlyArrayThunk (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\definition.js:500:40)
at defineInterfaces (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\definition.js:751:22)
at GraphQLObjectType._interfaces (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\definition.js:693:30)
at GraphQLObjectType.getInterfaces (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\definition.js:718:31)
at collectReferencedTypes (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\schema.js:383:45)
at new GraphQLSchema (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\type\schema.js:174:9)
at buildASTSchema (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql\utilities\buildASTSchema.js:93:10)
at validateSchemaDefinition (C:\Users\USX21602\AppData\Roaming\npm\node_modules\graphql-schema-linter\lib\validator.js:53:53)

Initially I thought I missed a dependency so I installed the flatmap package, but I still get the same error.

The machine I'm running it on is a Windows 10 box with npm 6.9.0 installed. npm is telling me everything is up to date

That's interesting. 🤔

What version of node are you using?

It was 10.0.something. In other words, it was really old. 🙄 Updated and now it seems to work.

I'll close out the bug.

Stupid user issue. Closing.

No worries! Happy the issue is resolved! Perhaps the library should require a minimum node version so that errors aren't obscure.