Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error messages - debugging tasks is hard #881

Closed
mik01aj opened this issue Jan 27, 2015 · 5 comments
Closed

Cryptic error messages - debugging tasks is hard #881

mik01aj opened this issue Jan 27, 2015 · 5 comments

Comments

@mik01aj
Copy link

mik01aj commented Jan 27, 2015

Hi, I just created a new project using yo react-gulp-browserify. I run gulp watch and get the following output:

[12:17:28] Using gulpfile ~/code/react-frontend/gulpfile.js
[12:17:28] Starting 'html'...
[12:17:28] Starting 'scripts'...
[12:17:28] Starting 'bower'...
[12:17:28] Finished 'bower' after 1.34 ms
[12:17:28] Starting 'serve'...
[12:17:28] Webserver started at http://localhost:9000
[12:17:28] Finished 'serve' after 231 ms
[12:17:28] all files 1.87 kB
[12:17:28] Finished 'html' after 501 ms
[12:17:30] Finished 'scripts' after 2.04 s
[12:17:30] Starting 'bundle'...

events.js:74
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at Transform.emit (events.js:74:15)
    at Transform.onerror (/Users/mik01aj/code/react-frontend/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:558:12)
    at Transform.emit (events.js:95:17)
    at Transform.<anonymous> (/Users/mik01aj/code/react-frontend/node_modules/gulp-useref/index.js:76:42)
    at Array.forEach (native)
    at Transform.<anonymous> (/Users/mik01aj/code/react-frontend/node_modules/gulp-useref/index.js:66:35)
    at Array.forEach (native)
    at Transform.<anonymous> (/Users/mik01aj/code/react-frontend/node_modules/gulp-useref/index.js:44:36)
    at Array.forEach (native)

My point is, the error message should contain some basic information like:

  • where is the events.js file specified in the stacktrace?
  • what line in my gulpfile caused the problem?
  • what plugin caused the problem?
  • what task caused the problem? (was it bundle? Can I be sure?)
  • (ideally) how can I fix it?

What's even more interesting, I searched all the files in my node_modules for the line and here's what I found:

node_modules/browserify/node_modules/events/events.js
61:      throw TypeError('Uncaught, unspecified "error" event.');

node_modules/gulp-jshint/node_modules/jshint/dist/jshint-rhino.js
467:      throw TypeError('Uncaught, unspecified "error" event.');

node_modules/gulp-jshint/node_modules/jshint/dist/jshint.js
465:      throw TypeError('Uncaught, unspecified "error" event.');

node_modules/watchify/node_modules/browserify/node_modules/events/events.js
61:      throw TypeError('Uncaught, unspecified "error" event.');

None of them is events.js:74, specified in the stacktrace.

All this makes gulp tasks extremely hard to debug.

@mik01aj
Copy link
Author

mik01aj commented Jan 27, 2015

This might be related to #359.

@heikki
Copy link
Contributor

heikki commented Jan 27, 2015

@mik01aj
Copy link
Author

mik01aj commented Jan 27, 2015

@heikki , while this might solve my problem with react-gulp-browserify, my point about error messages remains valid. But thanks for the help, anyway :)

@heikki
Copy link
Contributor

heikki commented Jan 27, 2015

Yes, I contributed what I could on short notice. 😄

@phated
Copy link
Member

phated commented Jan 27, 2015

This is a normal async stack trace in node. If you are having problems, I would suggest using a module like https://www.npmjs.com/package/stackup at the top of your gulpfile to get long stack traces.

@phated phated closed this as completed Jan 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants