noseglid / atom-build

:hammer: Build your project directly from the Atom editor
https://atom.io/packages/build
MIT License
248 stars 97 forks source link

Builds never exits AND `emitter.prependListener is not a function` is thrown #481

Closed tildebyte closed 7 years ago

tildebyte commented 7 years ago

Since #438 and #441 have been closed, but this issue persists and involves both...

Win 10 x64, atom 1.12.0-beta3

I've uninstalled sync-settings and atom-beautify and restarted atom, and I'm still getting the Failed to build: emitter.prependListener is not a function error message when building. I don't find emitter.prependListener being referenced in any other package which I have installed[1].

The build "works" with an .atom-build.yml which contains only cmd: echo Hello world in the root of the project (i.e. prints Hello world), but runs indefinitely after that, and I have to restart atom to attempt to build again.

No errors in the console. Nothing in the console, actually.

[1] There may be an atom core package which pulls in emitter.prependListener in some way, but I don't have the time to grep through all of their sources (although I did search atom itself).

hultberg commented 7 years ago

Same issue here. However, I do not have sync-settings, nor atom-beautify installed.

apm  1.13.0
npm  3.10.5
node 4.4.5
python 2.7.12
git 2.10.1
noseglid commented 7 years ago

I'm sorry to say I have no idea what this is or where it comes from.

I've just published version v0.66.0. It should include a stacktrace in that error message when you get it. Could either of you supply a screenshot of that stack?

boxama commented 7 years ago

I'm also having this error. I just updated and managed to catch a stack trace (the notification only gives you a few seconds to do so)

Failed to build.
emitter.prependListener is not a function
Hide Stack Trace
TypeError: emitter.prependListener is not a function
    at prependListener (_stream_readable.js:19:20)
    at Socket.Readable.pipe (_stream_readable.js:584:3)
    at /home/user/.atom/packages/build/lib/build.js:170:25
noseglid commented 7 years ago

Great @boxama . This sheds some light.

The code in question is when build is trying to pipe all output data to the view.

Something goes wrong inside the core lib... i'm not sure why. It's almost certainly not an issue with atom-build itself.

Not sure why it only happens to some either...

tildebyte commented 7 years ago

Yeah, I wondered about that... I tested with a job which I knew would definitely error out, but got no output at all frombuild

hultberg commented 7 years ago

Even though it might not be an issue directly with this package, it certainly makes it useless. Do you have any idea where to start debugging, would like to make this package work.

noseglid commented 7 years ago

It's difficult since I never get the error and have no way of reproducing..

Could you try adding something like this.terminal.prependListener = () => { console.log('listener prepended') } at https://github.com/noseglid/atom-build/blob/master/lib/build-view.js#L45, then check the logs and see if you get the 'listener prepended' message. This is my best theory at the moment and this could verify/discredit that.

boxama commented 7 years ago

Actually, adding the prependListener method fixes the problem. Perhaps it should be added as a fix until this is ideally fixed upstream? I'm not sure if it's been reported before but a fix hasn't been released yet.

noseglid commented 7 years ago

That's good. My theory is correct then.

As a work around right now I think a good course of action is to implement it using the addListener. Sure, it will be at the end of the event list rather than at the beginning, but hopefully it wont cause any issues.

As a long term solution, the terminal package should be replaced with something more maintained. Such discussions are ongoing

hultberg commented 7 years ago

@noseglid That did it for me too, thanks for the quickfix!

noseglid commented 7 years ago

Cool. I'll try and get a workaround in soon and release it. Thanks for reports and help debugging.

kelexel commented 7 years ago

I had the same issue, it happened after I disabled, than later, re-enabled all platformio and build packages. I can confirm the above fix is working for me. Thank you !!! :)

nbJosh commented 7 years ago

Just lost the ability to build. happened after updating packages in atom.

Above fix working.

noseglid commented 7 years ago

v0.67.0 released with this fix