gatsby: MaxListenersExceededWarning errors with gatsby-plugin-image StaticImage with placeholder
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
A console error occurs on develop and build when using StaticImage from gatsby-plugin-image with a placeholder attribute, e.g:
<StaticImage src="../images/photo-1.jpg" alt="" placeholder="blurred" />
- Using
gatsby developorgatsby build:
ERROR
(node:15194) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [PassThrough]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
- Using
node --trace-warnings node_modules/.bin/gatsby develop:
ERROR
(node:15473) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [PassThrough]. Use emitter.setMaxListeners() to increase limit
at _addListener (node:events:595:17)
at PassThrough.addListener (node:events:617:10)
at PassThrough.Readable.on (node:internal/streams/readable:899:35)
at eos (node:internal/streams/end-of-stream:169:10)
at pipe (node:internal/streams/pipeline:348:3)
at pipelineImpl (node:internal/streams/pipeline:293:9)
at pipeline (node:internal/streams/pipeline:146:10)
at probeStream (/Users/hewitt/path/to/project/node_modules/probe-image-size/stream.js:63:8)
at get_image_size (/Users/hewitt/path/to/project/node_modules/probe-image-size/index.js:13:12)
at getImageSizeAsync (/Users/hewitt/path/to/project/node_modules/gatsby-plugin-sharp/index.js:63:28)
at getImageMetadata (/Users/hewitt/path/to/project/node_modules/gatsby-plugin-sharp/image-data.js:33:39)
at generateImageData (/Users/hewitt/path/to/project/node_modules/gatsby-plugin-sharp/image-data.js:123:26)
at /Users/hewitt/path/to/project/node_modules/gatsby-plugin-image/dist/node-apis/image-processing.js:255:42
at step (/Users/hewitt/path/to/project/node_modules/gatsby-plugin-image/dist/node-apis/image-processing.js:33:23)
at Object.next (/Users/hewitt/path/to/project/node_modules/gatsby-plugin-image/dist/node-apis/image-processing.js:14:53)
at /Users/hewitt/path/to/project/node_modules/gatsby-plugin-image/dist/node-apis/image-processing.js:8:71
Nothing seems to be visibly affected by the error - the build continues successfully afterwards.
Reproduction Link
https://github.com/jonohewitt/gatsby-image-bug-repro
Steps to Reproduce
- Install the reproduction project
- Run
gatsby developto see basic error - Run
node --trace-warnings node_modules/.bin/gatsby developto see verbose error
Expected Result
No error
Actual Result
Error
Environment
System:
OS: macOS 12.1
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.4.0 - /usr/local/bin/node
Yarn: 1.22.17 - ~/.yarn/bin/yarn
npm: 8.3.1 - /usr/local/bin/npm
Languages:
Python: 2.7.18 - /usr/bin/python
Browsers:
Chrome: 98.0.4758.80
Safari: 15.2
npmPackages:
gatsby: ^4.7.1 => 4.7.1
gatsby-plugin-image: ^2.7.0 => 2.7.0
gatsby-plugin-sharp: ^4.7.0 => 4.7.0
gatsby-source-filesystem: ^4.7.0 => 4.7.0
Config Flags
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 15 (7 by maintainers)
When this will happen, who knows 😛 they’re currently locked to v6!
That said, following this mindset and forcing an override by adding
Fixed the issue for me completely 👍.
probe-image-sizedoesn’t seem to follow semver so 6 -> 7 didn’t appear to have any breaking changes based on their Changelog. Thanks @hendra-go!Hello @danielmacuare
The code above should be inserted to your project’s
package.jsonit is a Yarn’s Selective dependency resolutions so you should use Yarn instead npmAs an example, i use this
package.jsonfrom @jonohewitt’s repoAfter you insert the resolutions, run
yarn installagainThis is what I’m getting.
I can confirm that I am seing the exact same issue here, however the
placeholderattribute is being set in thegraphqlquery in my case.However I am running node 14.xx and Gatsby 3.x with Gatsby image plugin 1.13.0.