ngx-deploy-npm: [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded

Hi there, I have a Stenciljs web component library set up on my Nx monorepo, and whenever I try to deploy (publish) the library I get the following error:

CleanShot 2022-11-02 at 14 25 25

If I manually run npm publish over the library build, it works as expected. Any idea what can be the reason for ngx-deploy-npm failing?

I want to mention that it runs ok in another library under the same monorepo (a react wrapper library for the web component library discussed before).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@dgonzalezr using V4.3.2, you will be able to publish your package.

Let’s leave this issue open while I work on a more permanent fix. Please leave your public repo alive so I can have a real-world scenario for testing

@dgonzalezr an idea that I have, as hot fix. I can increase the buffer to its maximum to see if that’s enough to allow you publish.

I can do that very quickly, so you’ll be able to move forward. In the meantime, I’ll be working on the fix described above.

It works for you?

I found the problem.

npm publish creates a list of all the files in your bundle. The number of files in your bundle is large. So large that my terminal couldn’t print it all, I couldn’t scroll across the output because it got cut.

We execute the npm publish command using child_process.exec and a particularity that child_process.exec has is when the size of the stdout is bigger than the default amount of buffer it produces an error.

That’s why you are able to execute the command without problems, but ngx-deploy-npm don’t.

See node child_process.exec documentation

maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.


The solution seems to be using child_process.spawn instead. They have events instead of a buffer to expose the stdout.

I would work on the fix.

I have access now.

I took a look, and everything seems to be in order. I’m going to debug the publish-beta operation on your code base to see step by step to watch more in-depth what could be the reason.

I’ll try to do that today at night.