question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"gatsby-transformer-remark" threw an error while running the setFieldsOnGraphQLNodeType lifecycle: Cannot read property 'setParserPlugins' of undefined

See original GitHub issue

Preliminary Checks

Description

Issue with images in a GatsbyJs v4 project: Field “image” must not have a selection since type “String” has no subfields.

Had originally converted a Gatsby v3 project to v4 and kept getting "String" has no subfields message when running a gatsby build.

Stripped back to a minimum repo and still experiencing the issue, but also now getting issues with gatsby develop.

Erroroneous plugins: gatsby-transformer-remark and gatsby-remark-relative-images.

Reproduction Link

https://github.com/jf-home/gatsby4-images

Steps to Reproduce

  1. Clone the repo
  2. npm i
  3. gatsby develop
  4. gatsby clean
  5. gatsby build

Expected Result

Site should run in develop and build without errors.

Actual Result

Output from a gatsby develop:

PS C:\home\g4-images> gatsby develop Error: Cannot find module ‘C:/home/g4-images/node_modules/gatsby-remark-relative-images/index’ Require stack:

  • C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
  • C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
  • C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
  • C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-config-and-plugins.js
  • C:\home\g4-images\node_modules\gatsby\dist\services\initialize.js
  • C:\home\g4-images\node_modules\gatsby\dist\services\index.js
  • C:\home\g4-images\node_modules\gatsby\dist\state-machines\develop\services.js
  • C:\home\g4-images\node_modules\gatsby\dist\state-machines\develop\index.js
  • C:\home\g4-images\node_modules\gatsby\dist\commands\develop-process.js
  • C:\home\g4-images.cache\tmp-6452-lcM26brB3Eo8 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.resolve (C:\home\g4-images\node_modules\v8-compile-cache\v8-compile-cache.js:164:23) at C:\home\g4-images\node_modules\gatsby\src\bootstrap\load-plugins\validate.ts:234:52 at Object.validate (C:\home\g4-images\node_modules\joi\lib\types\any.js:47:28) at Object.internals.rules (C:\home\g4-images\node_modules\joi\lib\validator.js:394:33) at Object.exports.validate (C:\home\g4-images\node_modules\joi\lib\validator.js:350:22) at internals.Base.$_validate (C:\home\g4-images\node_modules\joi\lib\base.js:773:26) at Object.validate (C:\home\g4-images\node_modules\joi\lib\types\array.js:273:45) at Object.internals.rules (C:\home\g4-images\node_modules\joi\lib\validator.js:394:33) at Object.exports.validate (C:\home\g4-images\node_modules\joi\lib\validator.js:350:22) at internals.Base.$_validate (C:\home\g4-images\node_modules\joi\lib\base.js:773:26) at Object.validate (C:\home\g4-images\node_modules\joi\lib\types\keys.js:108:45) at Object.exports.validate (C:\home\g4-images\node_modules\joi\lib\validator.js:325:26) at Object.internals.entry (C:\home\g4-images\node_modules\joi\lib\validator.js:142:28) at Object.exports.entryAsync (C:\home\g4-images\node_modules\joi\lib\validator.js:58:30) at internals.Base.validateAsync (C:\home\g4-images\node_modules\joi\lib\base.js:553:26) { code: ‘MODULE_NOT_FOUND’, requireStack: [ ‘C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\load.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-plugins\index.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\bootstrap\load-config-and-plugins.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\services\initialize.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\services\index.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\state-machines\develop\services.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\state-machines\develop\index.js’, ‘C:\home\g4-images\node_modules\gatsby\dist\commands\develop-process.js’, ‘C:\home\g4-images\.cache\tmp-6452-lcM26brB3Eo8’ ] } warn Plugin gatsby-plugin-netlify is not compatible with your gatsby version 4.1.0 - It requires gatsby@^3.0.0 warn Plugin gatsby-transformer-remark-frontmatter is not compatible with your gatsby version 4.1.0 - It requires gatsby@^3.6.2 warn Plugin gatsby-plugin-netlify is not compatible with your gatsby version 4.1.0 - It requires gatsby@^3.0.0 warn Plugin gatsby-transformer-remark-frontmatter is not compatible with your gatsby version 4.1.0 - It requires gatsby@^3.6.2 success open and validate gatsby-configs, load plugins - 3.041s success onPreInit - 0.010s success initialize cache - 0.169s success copy gatsby files - 0.356s success Compiling Gatsby Functions - 0.518s success onPreBootstrap - 0.554s

ERROR #11321 PLUGIN

“gatsby-transformer-remark” threw an error while running the createSchemaCustomization lifecycle:

Cannot read property ‘createSchemaCustomization’ of undefined

TypeError: Cannot read property ‘createSchemaCustomization’ of undefined

  • create-schema-customization.js:47 [g4-images]/[gatsby-transformer-remark]/create-schema-customization.js:47:31

  • Array.forEach

  • create-schema-customization.js:44 Object.module.exports [as createSchemaCustomization] [g4-images]/[gatsby-transformer-remark]/create-schema-customization.js:44:11

  • api-runner-node.js:430 runAPI [g4-images]/[gatsby]/src/utils/api-runner-node.js:430:22

  • api-runner-node.js:581 Promise.catch.decorateEvent.pluginName [g4-images]/[gatsby]/src/utils/api-runner-node.js:581:13

  • debuggability.js:384 Promise._execute [g4-images]/[bluebird]/js/release/debuggability.js:384:9

  • promise.js:518 Promise._resolveFromExecutor [g4-images]/[bluebird]/js/release/promise.js:518:18

  • promise.js:103 new Promise [g4-images]/[bluebird]/js/release/promise.js:103:10

  • api-runner-node.js:579 [g4-images]/[gatsby]/src/utils/api-runner-node.js:579:16

  • util.js:16 tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • reduce.js:166 Object.gotValue [g4-images]/[bluebird]/js/release/reduce.js:166:18

  • reduce.js:155 Object.gotAccum [g4-images]/[bluebird]/js/release/reduce.js:155:25

  • util.js:16 Object.tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • promise.js:547 Promise._settlePromiseFromHandler [g4-images]/[bluebird]/js/release/promise.js:547:31

  • promise.js:604 Promise._settlePromise [g4-images]/[bluebird]/js/release/promise.js:604:18

  • promise.js:649 Promise._settlePromise0 [g4-images]/[bluebird]/js/release/promise.js:649:10

success createSchemaCustomization - 0.203s success Checking for changed pages - 0.002s success source and transform nodes - 0.293s

ERROR #11321 PLUGIN

“gatsby-transformer-remark” threw an error while running the setFieldsOnGraphQLNodeType lifecycle:

Cannot read property ‘setParserPlugins’ of undefined

TypeError: Cannot read property ‘setParserPlugins’ of undefined

  • extend-node-type.js:146 [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:146:39

  • new Promise

  • extend-node-type.js:111 Object.remarkExtendNodeType [as setFieldsOnGraphQLNodeType] [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:111:10

  • api-runner-node.js:430 runAPI [g4-images]/[gatsby]/src/utils/api-runner-node.js:430:22

  • api-runner-node.js:581 Promise.catch.decorateEvent.pluginName [g4-images]/[gatsby]/src/utils/api-runner-node.js:581:13

  • debuggability.js:384 Promise._execute [g4-images]/[bluebird]/js/release/debuggability.js:384:9

  • promise.js:518 Promise._resolveFromExecutor [g4-images]/[bluebird]/js/release/promise.js:518:18

  • promise.js:103 new Promise [g4-images]/[bluebird]/js/release/promise.js:103:10

  • api-runner-node.js:579 [g4-images]/[gatsby]/src/utils/api-runner-node.js:579:16

  • util.js:16 tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • reduce.js:166 Object.gotValue [g4-images]/[bluebird]/js/release/reduce.js:166:18

  • reduce.js:155 Object.gotAccum [g4-images]/[bluebird]/js/release/reduce.js:155:25

  • util.js:16 Object.tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • promise.js:547 Promise._settlePromiseFromHandler [g4-images]/[bluebird]/js/release/promise.js:547:31

  • promise.js:604 Promise._settlePromise [g4-images]/[bluebird]/js/release/promise.js:604:18

  • promise.js:649 Promise._settlePromise0 [g4-images]/[bluebird]/js/release/promise.js:649:10

ERROR #11321 PLUGIN

“gatsby-transformer-remark” threw an error while running the setFieldsOnGraphQLNodeType lifecycle:

Cannot read property ‘setParserPlugins’ of undefined

TypeError: Cannot read property ‘setParserPlugins’ of undefined

  • extend-node-type.js:146 [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:146:39

  • new Promise

  • extend-node-type.js:111 Object.remarkExtendNodeType [as setFieldsOnGraphQLNodeType] [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:111:10

  • api-runner-node.js:430 runAPI [g4-images]/[gatsby]/src/utils/api-runner-node.js:430:22

  • api-runner-node.js:581 Promise.catch.decorateEvent.pluginName [g4-images]/[gatsby]/src/utils/api-runner-node.js:581:13

  • debuggability.js:384 Promise._execute [g4-images]/[bluebird]/js/release/debuggability.js:384:9

  • promise.js:518 Promise._resolveFromExecutor [g4-images]/[bluebird]/js/release/promise.js:518:18

  • promise.js:103 new Promise [g4-images]/[bluebird]/js/release/promise.js:103:10

  • api-runner-node.js:579 [g4-images]/[gatsby]/src/utils/api-runner-node.js:579:16

  • util.js:16 tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • reduce.js:166 Object.gotValue [g4-images]/[bluebird]/js/release/reduce.js:166:18

  • reduce.js:155 Object.gotAccum [g4-images]/[bluebird]/js/release/reduce.js:155:25

  • util.js:16 Object.tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • promise.js:547 Promise._settlePromiseFromHandler [g4-images]/[bluebird]/js/release/promise.js:547:31

  • promise.js:604 Promise._settlePromise [g4-images]/[bluebird]/js/release/promise.js:604:18

  • promise.js:649 Promise._settlePromise0 [g4-images]/[bluebird]/js/release/promise.js:649:10

ERROR #11321 PLUGIN

“gatsby-transformer-remark” threw an error while running the setFieldsOnGraphQLNodeType lifecycle:

Cannot read property ‘setParserPlugins’ of undefined

TypeError: Cannot read property ‘setParserPlugins’ of undefined

  • extend-node-type.js:146 [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:146:39

  • new Promise

  • extend-node-type.js:111 Object.remarkExtendNodeType [as setFieldsOnGraphQLNodeType] [g4-images]/[gatsby-transformer-remark]/extend-node-type.js:111:10

  • api-runner-node.js:430 runAPI [g4-images]/[gatsby]/src/utils/api-runner-node.js:430:22

  • api-runner-node.js:581 Promise.catch.decorateEvent.pluginName [g4-images]/[gatsby]/src/utils/api-runner-node.js:581:13

  • debuggability.js:384 Promise._execute [g4-images]/[bluebird]/js/release/debuggability.js:384:9

  • promise.js:518 Promise._resolveFromExecutor [g4-images]/[bluebird]/js/release/promise.js:518:18

  • promise.js:103 new Promise [g4-images]/[bluebird]/js/release/promise.js:103:10

  • api-runner-node.js:579 [g4-images]/[gatsby]/src/utils/api-runner-node.js:579:16

  • util.js:16 tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • reduce.js:166 Object.gotValue [g4-images]/[bluebird]/js/release/reduce.js:166:18

  • reduce.js:155 Object.gotAccum [g4-images]/[bluebird]/js/release/reduce.js:155:25

  • util.js:16 Object.tryCatcher [g4-images]/[bluebird]/js/release/util.js:16:23

  • promise.js:547 Promise._settlePromiseFromHandler [g4-images]/[bluebird]/js/release/promise.js:547:31

  • promise.js:604 Promise._settlePromise [g4-images]/[bluebird]/js/release/promise.js:604:18

  • promise.js:649 Promise._settlePromise0 [g4-images]/[bluebird]/js/release/promise.js:649:10

success building schema - 1.079s success createPages - 0.004s success createPagesStatefully - 0.144s info Total nodes: 60, SitePage nodes: 2 (use --verbose for breakdown) success Checking for changed pages - 0.003s success write out redirect data - 0.007s success Build manifest and related icons - 0.073s success onPostBootstrap - 0.082s info bootstrap finished - 10.336s success onPreExtractQueries - 0.001s

ERROR #85922 GRAPHQL

There was an error in your GraphQL query:

  Field "image" must not have a selection since type "String" has no subfields.

  This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.
  However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see  

which fields you can query and what shape they have.

  It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
  "dummy content". Visit our docs to learn how you can define the schema for "undefined":
  https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization#creating-type-definitions

File: src\pages\index.js:30:15

failed extract queries from components - 2.347s success write out requires - 0.161s success run static queries - 0.056s - 1/1 17.70/s success run page queries - 0.027s - 1/1 37.02/s DONE Compiled successfully in 6675ms 21:32:23⠀ I Netlify CMS is running at http://localhost:8000/admin/ ⠀ You can now view g4-images in the browser. ⠀ ⠀ ⠀ http://localhost:8000/___graphql Note that the development build is not optimized. To create a production build, use gatsby build ⠀ success Building development bundle - 19.438s success Writing page-data.json files to public directory - 0.148s - 1/2 13.49/s

Environment

System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 14.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.9.0
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (95.0.1020.40)
  npmPackages:
    gatsby: ^4.1.0 => 4.1.0
    gatsby-background-image: ^1.5.3 => 1.5.3
    gatsby-plugin-catch-links: ^4.1.0 => 4.1.0
    gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1
    gatsby-plugin-html-attributes: ^1.0.5 => 1.0.5
    gatsby-plugin-image: ^2.1.0 => 2.1.0
    gatsby-plugin-manifest: ^4.1.0 => 4.1.0
    gatsby-plugin-netlify: ^3.14.0 => 3.14.0
    gatsby-plugin-netlify-cms: ^6.1.0 => 6.1.0
    gatsby-plugin-offline: ^5.1.0 => 5.1.0
    gatsby-plugin-react-helmet: ^5.1.0 => 5.1.0
    gatsby-plugin-sharp: ^4.1.0 => 4.1.0
    gatsby-remark-images: ^6.1.0 => 6.1.0
    gatsby-remark-relative-images: ^2.0.2 => 2.0.2
    gatsby-source-filesystem: ^4.1.0 => 4.1.0
    gatsby-transformer-remark: ^5.1.0 => 5.1.0
    gatsby-transformer-remark-frontmatter: ^1.1.0 => 1.1.0
    gatsby-transformer-sharp: ^4.1.0 => 4.1.0
  npmGlobalPackages:
    gatsby-cli: 2.12.114

Config Flags

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Han-Simcommented, Jan 8, 2022

This error is still reproducible in gatsby v4.4.0

1reaction
donaldboultoncommented, Jan 12, 2022

With v4.5.0 the example on Remark Purple Headers throws the same errors.

Cannot read property ‘setParserPlugins’ of undefined.

I have the same error for any plugin in the plugin directory.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby transformer sharp createSchemaCustomization ...
Im having an issue when deploying to digitalocean a gatsby app. Im getting the following error: ERROR #11321 PLUGIN [2021-05-04 ...
Read more >
gatsby-transformer-remark
All frontmatter fields are converted into GraphQL fields through inference. This plugin adds additional fields to the MarkdownRemark GraphQL type including html ...
Read more >
How to add search to your Gatsby site - Emma Goto
A search bar is a great way to make content on your Gatsby site discoverable. In this tutorial, I'll be walking you through...
Read more >
Cant build site can someone help me? : r/gatsbyjs - Reddit
"gatsby-node.js" threw an error while running the createPages lifecycle: Cannot read properties of null (reading 'includes').
Read more >
gatsby-remark-copy-linked-files causes errors when ...
... PLUGIN "gatsby-transformer-remark" threw an error while running the setFieldsOnGraphQLNodeType lifecycle: Cannot read properties of undefined (reading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found