Hyper: JavaScript error in main process

Created on 18 Jul 2016  Â·  30Comments  Â·  Source: vercel/hyper

Seems to be triggered by the hypterterm-1password plugin, so it might be a problem with that extension. Figured I'd share it anyhow, since probably this shouldn't be possible anyway.

Uncaught Exception:
Error: watch /Users/isaacs/.node-spawn-wrap-24946-c86a459da0b6 ENOENT
    at exports._errnoException (util.js:949:11)
    at FSWatcher.start (fs.js:1433:19)
    at Object.fs.watch (fs.js:1460:11)
    at Gaze._watchDir (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:288:30)
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:357:10
    at iterate (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:78:11
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:422:5
    at iterate (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:78:11
help wanted OMG Maximum Bug

Most helpful comment

Getting the exact same error when I try to use nyc

$ nyc ava

All 30 comments

Getting the exact same error when I try to use nyc

$ nyc ava

I got this after installing hyperterm-colors and hyperterm-spacegray:

skarmavbild 2016-07-25 kl 23 21 26

This was for a first time install, couldn't repro for subsequent installs of the plugins.

Yeah @SamVerschueren. I get this error right now and I'm running ava in another window (not-hyperterm).

Since this has been reported a multiple times, I'm going to mark it as Priority: High.

Related/duplicates: #357, #401, #444, #542, #564, #587, #680

Anyone have any insight on this? Can this exception be safely ignored?

I no longer believe that this is related to hypterterm-1password. It's definitely got something to do with spawn-wrap and nyc. Not clear how those are causing this error, though.

I have the same issue with nyc without the 1password plugin.

I have the same error without any plugins :(

@isaacs If #587 and #444 actually are duplicates of this (as @matheuss has suggested by closing them in favor of this), then it doesn't even seem related to either nyc _or_ spawn-wrap directly; the paths /Users/hq/.hyperterm_plugins/node_modules/.staging (from #587) and /Users/iradchenko/.google-cloud-sdk.staging (from #444) seem unrelated. I know I've gotten this type of error without ever using nyc; I'm pretty sure I don't have any projects on my system which use Istanbul.

It does seem like @rauchg's comment on #542 might be our best lead, since gaze does seem to be the common source of these errors, and it seems that it's watching files it shouldn't be. (ones outside the HyperTerm config directory)

Pretty sure this is because we don't handle the error event from gaze. According to @shama's comment on #542, the bug was fixed on gaze's side, but that just means the error now gets emitted from the gaze object, instead of being unhandled on the FSWatcher object. We still need to handle that event in HyperTerm's code, or it will crash the process in the same way.

706 Another one, probably dup, and originating from .hyperterm_plugins with _slightly_ different exception stack.

@whitelynx Ah, that's interesting! I wonder if gaze is incorrectly watching files that are being created in the home directory by spawn-wrap in folders like ~/.node-spawn-wrap-xxxxxx, and then when the process ends and those files disappear, it freaks out with an ENOENT.

I'm getting this with nyc as well. Here's my stacktrace:

Uncaught Exception:
Error: watch /Users/brandon/.node-spawn-wrap-57998-93b051b6d4bb ENOENT
    at exports._errnoException (util.js:949:11)
    at FSWatcher.start (fs.js:1433:19)
    at Object.fs.watch (fs.js:1460:11)
    at Gaze._watchDir (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:288:30)
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:357:10
    at iterate (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:78:11
    at /Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:422:5
    at iterate (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at Object.forEachSeries (/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:83:3)

I was able to work around this with the following patch:

diff --git a/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js.original b/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js
index fe80d80..b684d35 100644
--- a/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js.original
+++ b/Applications/HyperTerm.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js
@@ -296,9 +296,9 @@ Gaze.prototype._watchDir = function (dir, done) {
           done(null, dir);
         }
       }, delay + 100);
-    })
+    }).on('error', function (err) {})
   } catch (err) {
-    return this._handleError(err);
+    return this
   }
   return this;
 };

Not sure if this is helpful, or should be sent upstream to gaze, or what.

This commit on gaze seems to fix the error:
https://github.com/shama/gaze/commit/264101644d105f010e382e371db4eda0e45cbdfd

I have hacked it in manually to my Hyperterm installation and seemed to be working like a charm.

@H1rag4mi patched it manually and now it seems to fail only when hyperterm is in the background but still issue exists.

Got the same, when hyperterm was in the background
image

Same error, also when using nyc.

Uncaught Exception:
Error: watch /Users/tommy.leunen/.node-spawn-wrap-14935-c1542e645938 ENOENT
    at exports._errnoException (util.js:1026:11)
    at FSWatcher.start (fs.js:1439:19)
    at Object.fs.watch (fs.js:1466:11)
    at Gaze._watchDir (/Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:288:30)
    at /Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:357:10
    at iterate (/Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at /Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:78:11
    at /Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/gaze.js:422:5
    at iterate (/Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:69:5)
    at /Applications/Hyper.app/Contents/Resources/app/node_modules/gaze/lib/helper.js:78:11

@H1rag4mi I made the fix on my local app and I still have the errors :/ Looks like what @krzkaczor describes...

Don't know if this helps but I just got the same error when mving a directory just after creating it. Furthermore subsequent calls to mkdir often (but not always) throw the exception as well. I can reproduce it on my machine; although I sometimes have to do the mv multiple times to trigger. Also note every subsequent exception references the original dir (the one that was mved). OS X 10.11, HyperTerm 0.8.1.
screen shot 2016-10-14 at 12 11 49 pm
Steps to reproduce:

~ $ mkdir test
~ $ mv test/ test2 #Throws exception referencing ~/test
# sometimes I need to `mv test2/ test3`, etc to reproduce.
~ $ mkdir test3 #Throws exception referencing ~/test as well

I thought we'd bumped gaze to fix this issue. We have to make sure it's at the latest.

I can confirm that this is still present on 0.8.2 using the method I described above to reproduce.

Hmm dang, I'll try @jcoetzee's repro steps today and see what's up.

@shama thanks so much for following up 🎉 let me know when I should bump and release

Is there any progress on this? I'm my office is still getting a version of this error.

I'm also getting it, especially when doing a make and many files are being created and deleted 😟

What version are you running? Latest?

– @rauchg https://twitter.com/rauchg

On Fri, Dec 2, 2016 at 1:40 AM, H1rag4mi notifications@github.com wrote:

I'm also getting it, especially when doing a make and many files are being
created and deleted 😟

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/zeit/hyper/issues/225#issuecomment-264340349, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAy8Qx_oQs6X1k320JnSLZqLjfOCvQCks5rD2kNgaJpZM4JOdYs
.

I'm on Hyper 0.8.3.873, and I just got a similar error when trying to customize my startup shell command.

I was able to get a minimal reproduction of the error by setting:

 shell: 'bash -c /bin/bash'

in ~/.hyper.js. That same command works when I run it in an existing shell.

The error dialog:

blank_skitch_document

Stacktrace:

Uncaught Exception:
Error: spawn bash -c /bin/bash ENOENT
    at Object.exports._errnoException (util.js:1026:11)
    at Socket.<anonymous> (/Applications/Hyper.app/Contents/Resources/app/node_modules/child_pty/lib/child_pty.js:103:15)
    at Socket.g (events.js:286:16)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:543:20)

I get this error for a long time. But sometimes, when the network is in good condition. It works. Nothing was changed with hyper.

was there ever an official fix for this? i've been getting this error off and on for months now, and i can't seem to find a working fix for it? it seems to happen most often—at least as far as i can tell—when i have some dir or another open in hyper, and i create a new dir, delete a dir, etc. so it seems linked in some way to the watch process (obviously, i guess), and the ability to refresh the current contents of the dir. i specifically noticed this, and have been able to recreate it, when i—for example—navigate to a particular dir and then add a dir through the finder.

realistically, this wouldn't be that big of a deal, except that sometimes it just seems to get caught in a loop in itself, and once i hit "OK" the error just comes up again, and again, and again, until i just force quit the application and restart it.

i'm on the most recent version of hyper, and my plugins are as follows—

"dependencies": {
    "hyper-blink": "latest",
    "hyper-material-vibrancy": "latest",
    "hyper-stylesheet": "latest",
    "hyperminimal": "latest",
    "hyperborder": "latest",
    "hyper-search": "latest"
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

eoinmurray picture eoinmurray  Â·  3Comments

ghost picture ghost  Â·  3Comments

alejandrofloresm picture alejandrofloresm  Â·  3Comments

daenuprobst picture daenuprobst  Â·  3Comments

weabot picture weabot  Â·  3Comments