gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.22k stars 10.33k forks source link

ERROR UNHANLED REJECTION #15932

Closed jeremd41 closed 5 years ago

jeremd41 commented 5 years ago

Hello everyone !

Before I begin, I would like to point out that I am French. Sorry for my English which can be bad....

Description

npm install ok but when I start gatsby develop, I get an ERROR UNHANDLED REJECTION.

I try to resolve this since 3-4 weeks ago... But without success

Steps to reproduce

https://github.com/jeremd41/testgats You can clone this repository

gatsby new testgats 
gatsby develop

Expected result

Start development server

Actual result

success open and validate gatsby-configs - 0.224 s
success load plugins - 1.804 s
success onPreInit - 0.049 s
success initialize cache - 0.069 s
success copy gatsby files - 0.117 s
success onPreBootstrap - 0.058 s
success source and transform nodes - 0.292 s
success building schema - 1.113 s
success createPages - 0.038 s
success createPagesStatefully - 0.261 s
success onPreExtractQueries - 0.049 s
success update schema - 0.182 s
success extract queries from components - 1.376 s
success write out requires - 0.077 s
success write out redirect data - 0.053 s
success Build manifest and related icons - 0.724 s
success onPostBootstrap - 0.821 s
⠀
info bootstrap finished - 15.223 s
⠀
⠼ run static queries
[====                        ]   0.548 s 1/6 17% Generating image thumbnails

 ERROR 

UNHANDLED REJECTION {
  err: Error
      at afterWriteDispatched (internal/stream_base_commons.js:146:25)
      at writeGeneric (internal/stream_base_commons.js:137:3)
      at Socket._writeGeneric (net.js:698:11)
      at Socket._write (net.js:710:8)
      at doWrite (_stream_writable.js:417:12)
      at writeOrBuffer (_stream_writable.js:401:5)
      at Socket.Writable.write (_stream_writable.js:301:11)
      at Socket.Writable.end (_stream_writable.js:582:10)
      at Socket.end (net.js:536:31)
      at handleInput (/home/webizy/Bureau/Devweb/testgats/node_modules/imagemin-pngquant/node_modules/execa/index.js:89:17)
      at module.exports (/home/webizy/Bureau/Devweb/testgats/node_modules/imagemin-pngquant/node_modules/execa/index.js:309:2)
      at /home/webizy/Bureau/Devweb/testgats/node_modules/imagemin-pngquant/index.js:52:13
      at Function.module.exports.buffer (/home/webizy/Bureau/Devweb/testgats/node_modules/imagemin/index.js:71:31)
      at /home/webizy/Bureau/Devweb/testgats/node_modules/gatsby-plugin-sharp/process-file.js:201:105
      at async /home/webizy/Bureau/Devweb/testgats/node_modules/gatsby-plugin-sharp/process-file.js:180:7
      at async Promise.all (index 0) {
    errno: 'EPIPE',
    code: 'EPIPE',
    syscall: 'write',
    stdout: <Buffer >,
    stderr: <Buffer >,
    failed: true,
    signal: null,
    cmd: '/home/webizy/Bureau/Devweb/testgats/node_modules/pngquant-bin/vendor/pngquant - --quality 50-75 --speed 4 --strip',
    timedOut: false,
    killed: false
  },
  message: 'Failed to process image /home/webizy/Bureau/Devweb/testgats/src/images/gatsby-astronaut.png'
}

  Error: {
    err: Error

  - stream_base_commons.js:146 afterWriteDispatched
    internal/stream_base_commons.js:146:25

  - stream_base_commons.js:137 writeGeneric
    internal/stream_base_commons.js:137:3

  - index.js:89 handleInput
    [testgats]/[imagemin-pngquant]/[execa]/index.js:89:17

  - index.js:309 module.exports
    [testgats]/[imagemin-pngquant]/[execa]/index.js:309:2

  - index.js:52 
    [testgats]/[imagemin-pngquant]/index.js:52:13

  - index.js:71 Function.module.exports.buffer
    [testgats]/[imagemin]/index.js:71:31

  - process-file.js:201 
    [testgats]/[gatsby-plugin-sharp]/process-file.js:201:105

  - process-file.js:180 
    [testgats]/[gatsby-plugin-sharp]/process-file.js:180:7

  - errno: 'EPIPE',

  - code: 'EPIPE',

  - syscall: 'write',

  - stdout: <Buffer >,

  - stderr: <Buffer >,

  - failed: true,

  - signal: null,

  - cmd: '/home/webizy/Bureau/Devweb/testgats/node_modules/pngquant-bin/vendor/p    ngquant - --quality 50-75 --speed 4 --strip',

  - timedOut: false,

  - killed: false

  - },

  - message: 'Failed to process image /home/webizy/Bureau/Devweb/testgats/src/im    ages/gatsby-astronaut.png'

  - }

  - index.js:101 process.<anonymous>
    [lib]/[gatsby-cli]/lib/index.js:101:14

  - index.js:155 processEmit
    [lib]/[gatsby-cli]/[signal-exit]/index.js:155:32

  - index.js:155 processEmit [as emit]
    [testgats]/[signal-exit]/index.js:155:32

  - promises.js:201 processPromiseRejections
    internal/process/promises.js:201:33

  - task_queues.js:86 processTicksAndRejections
    internal/process/task_queues.js:86:32

### Environment

System:
    OS: Linux 4.18 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (4) x64 AMD A6-5200 APU with Radeon(TM) HD Graphics
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 12.6.0 - /usr/bin/node
    npm: 6.10.1 - /usr/bin/npm
  Languages:
    Python: 2.7.15+ - /usr/bin/python
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: 68.0
  npmPackages:
    gatsby: ^2.13.31 => 2.13.31
    gatsby-image: ^2.2.6 => 2.2.6
    gatsby-plugin-manifest: ^2.2.3 => 2.2.3
    gatsby-plugin-offline: ^2.2.4 => 2.2.4
    gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2
    gatsby-plugin-sharp: ^2.2.8 => 2.2.8
    gatsby-source-filesystem: ^2.1.5 => 2.1.5
    gatsby-transformer-sharp: ^2.2.4 => 2.2.4
  npmGlobalPackages:
    gatsby: 2.13.31

In advance, thank you

alec-francis commented 5 years ago

@jeremd41 I have the exact same issue

wardpeet commented 5 years ago

I can't seem to reproduce this issue.

I cloned your repo and ran the following steps

npm install
npm run develop

> gatsby develop

success open and validate gatsby-configs - 0.308 s
success load plugins - 1.881 s
success onPreInit - 0.242 s
success initialize cache - 0.302 s
success copy gatsby files - 0.559 s
success onPreBootstrap - 0.273 s
success source and transform nodes - 1.111 s
success building schema - 0.899 s
success createPages - 0.265 s
success createPagesStatefully - 0.397 s
success onPreExtractQueries - 0.246 s
success update schema - 0.326 s
success extract queries from components - 1.029 s
success write out requires - 0.296 s
success write out redirect data - 0.198 s
success Build manifest and related icons - 0.436 s
success onPostBootstrap - 0.665 s
⠀
info bootstrap finished - 15.497 s
⠀
success run static queries - 0.721 s — 3/3 6.28 queries/second
success Generating image thumbnails — 6/6 - 0.775 s
success run page queries - 0.300 s — 5/5 52.81 queries/second
 DONE  Compiled successfully in 6936ms                                                                                                                                                                                                                                                                                                                          12:55:28 PM⠀
You can now view gatsby-starter-default in the browser.
⠀
  http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
  http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build
⠀
i 「wdm」:
i 「wdm」: Compiled successfully.

could you paste the output of gatsby gatsby info --clipboard here. mine:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 10.15.3 - ~\scoop\apps\nvm\current\nodejs\nodejs\node.EXE
    Yarn: 1.15.2 - ~\scoop\apps\yarn\current\Yarn\bin\yarn.CMD
    npm: 6.10.1 - ~\scoop\apps\nvm\current\nodejs\nodejs\npm.CMD
  Languages:
    Python: 2.7.15
  Browsers:
    Edge: 44.18362.1.0
  npmPackages:
    gatsby: ^2.13.31 => 2.13.31 
    gatsby-image: ^2.2.6 => 2.2.6 
    gatsby-plugin-manifest: ^2.2.3 => 2.2.3 
    gatsby-plugin-offline: ^2.2.4 => 2.2.4 
    gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2 
    gatsby-plugin-sharp: ^2.2.8 => 2.2.8 
    gatsby-source-filesystem: ^2.1.5 => 2.1.5 
    gatsby-transformer-sharp: ^2.2.4 => 2.2.4 
alec-francis commented 5 years ago

@wardpeet I'm can't speak for OP but in my case I deleted my repo and re-cloned it and it resolved the issue.

Oddly I wasn't able to resolve it with the usual:

rm -rf node_modules
npm install
gatsby build

So far so good since, I'll come back here if the issue pops up again.

jeremd41 commented 5 years ago

I finally solved the problem.

I deleted the images + the image.js file in the component folder. Then deleted all imports that referred to files and components.

Everything is back to normal.

Thank you for your time.

wardpeet commented 5 years ago

That's weird, glad you got it working.

We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby! 💜

aqueenan commented 5 years ago

I encountered the same problem. npm didn't properly build cwebp because VSCode had closed the window to reload while npm was still running. This worked:

rm -rf node_modules/ .cache/
npm install
gatsby develop
johnhenriksson commented 4 years ago

I encountered the same problem. npm didn't properly build cwebp because VSCode had closed the window to reload while npm was still running. This worked:

rm -rf node_modules/ .cache/
npm install
gatsby develop

This worked for me, thanks!

dhilipkmr commented 3 years ago

I encountered the same problem. npm didn't properly build cwebp because VSCode had closed the window to reload while npm was still running. This worked:

rm -rf node_modules/ .cache/
npm install
gatsby develop

you are a lifesaver!!! Thanks a Lot 💯