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

It's horrible to see an error Module Not Found, but actually it is just a warning #71

Closed
benpptung opened this issue Feb 17, 2016 · 13 comments

Comments

@benpptung
Copy link

On https://github.com/chrisa/node-dtrace-provider/blob/master/dtrace-provider.js#L26
the errors are looking like the followings:
{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

I suggest to change the line to the following

console.error('Warning. dtrace provider binding not found in %s folder on %s', builds[i], process.platform);

Since Module Not Found is usually a fatal error, and it would be nice to tell the user that it is just a warning.

@davepacheco
Copy link
Collaborator

This seems like a fine change. I'd make it conditional based on code 'MODULE_NOT_FOUND', and I might add a note indicating that we did expect the provider to be found on this system. (We already skip the message entirely on systems where we don't expect the module to have been built.)

@benpptung
Copy link
Author

Great!! Thank you.
It would be a nice change, so some users ( like me ) won't be panic what it is..haha I am on FreeBSD. I've read these errors before, but forgot they are recently, so I suggest to change it :)

@mmocny
Copy link

mmocny commented Mar 4, 2016

A module I am using, tmi.js, which is using module bunyan which is using module dtrace-provider has started giving me console errors on every launch:

{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

I have removed the console messages locally, but perhaps console-ing to the end user is not the best way to signal error to the developer.

Perhaps exposing an event, or even just throwing an exception which can be caught, would be better? I am not sure. But the current behaviour I think is not great.

Thanks!

@mmocny
Copy link

mmocny commented Mar 4, 2016

To be clear: error -> warning is not sufficient, I think you should not be using console at all.

(Or perhaps the module bunyan should also not be using dtrace in releases, I am not sure.)

@davepacheco
Copy link
Collaborator

@mmocny The message is reporting that you're on a platform that appears to support DTrace, but the DTrace binding is not present. Was there a build failure leading up to this?

@mmocny
Copy link

mmocny commented Mar 4, 2016

I don't recall a build failure, but I may just have missed it. Another user did report one in tmijs/tmi.js#93.

That said, I think I've misplaced blame here. I think module bunyan should probably not have had dtrace-provider as a hard dependancy. It looks like its listed as both a hard dep and an optionalDependancy, and probably just needs an update to its package.json.

I have removed dtrace-provider from local node_modules and bunyan continues to work fine. I'll file an issue with them.

(I am assuming dtrace is needed only for debugging and not for releases?)

@davepacheco
Copy link
Collaborator

DTrace is not needed at all, but it's intended for releases (arguably even more than development, since there are many more options available in development).

@mmocny
Copy link

mmocny commented Mar 4, 2016

Thanks for that background! Looks like some users have resolved this issue by just re-installing node_modules: trentm/node-bunyan#361.

I've just done that, and it hasn't been resolved. Looking at the logs, there is indeed a failure, but seemingly only for v.0.5.0:

> dtrace-provider@0.5.0 install /Users/mmocny/dev/wat-inno15-livechat/app/node_modules/dtrace-provider
> node scripts/install.js

---------------
Building dtrace-provider failed with exit code 1 and signal 0
re-run install with environment variable V set to see the build output
---------------

> dtrace-provider@0.6.0 install /Users/mmocny/dev/wat-inno15-livechat/app/node_modules/restify/node_modules/dtrace-provider
> node scripts/install.js

Perhaps one of the modules is being too restrictive in its version requirements and needs to upgrade. I'll try that later.

Thanks for the responsiveness!

@mmocny
Copy link

mmocny commented Mar 4, 2016

Changing bunyan to use v0.6 of dtrace-provider resolved the issue. Huzzah!

Was there a known build issue for v0.5 for OSX?

@KingScooty
Copy link

Yeah, i've just spotted this issue when using node-restify on node v5.9.0. Was rather disconcerting at first, as i was writing tests.

Would be nice to have this error a little more user friendly if it's not a fatal error.

@ghost
Copy link

ghost commented Aug 27, 2016

I am suppressing these messages with dirty hack like this ...

var tmp = console.error;
console.error = function(){}
var dtraceProvider = require('dtrace-provider');
console.error = tmp;

@davepacheco
Copy link
Collaborator

I think this duplicates #41. Let me know if not.

@ORESoftware
Copy link

@mmocny how do you tell bunyan to use a diff version of Dtrace? thx

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

5 participants