node-bunyan icon indicating copy to clipboard operation
node-bunyan copied to clipboard

Fix error from undefined process.stderr

Open yehee opened this issue 5 years ago • 2 comments

  • Fix Uncaught TypeError: Cannot read property 'write' of undefined

yehee avatar Nov 07 '19 09:11 yehee

@alice-0-kim What environment are you running bunyan in which process.stderr isn't defined? Is this in a browser, perhaps?

(FYI on the delay in my responding: https://github.com/trentm/node-bunyan/issues/335#issuecomment-648583828)

trentm avatar Jun 24 '20 05:06 trentm

Instead of checking whether process.stderr is defined, could you replace process.stderr.write(msg + '\n') with console.error(msg)? That should work in a browser as well as Node.js without special handling.

joshkel avatar Mar 22 '21 14:03 joshkel