npm dtrace-provider occasional issue

Context: if you use a node module having dtrace-provider as one of its dependencies, even primary or optional, once in a while you may notice a peculiar error spit out from your node processes:

Error: Cannot find module './build/Debug/DTraceProviderBindings'

This usually happens when I upgrade my Node.js version then go back to maintaining a few week old codebase.

Top-of-mind solutions are npm rebuild or remove node_modules then re-install all npm modules. Somehow those don’t work for me in the case of dtrace-provider.

Instead, what works for me is:

cd node_modules/dtrace-provider

node-gyp rebuild

Bonus: sometimes I notice node-gyp is *gone*. Nada. Nothing. And of course without me messing anything with neither global nor local npm directories. In those cases, I either re-install node-gyp or try to run the above commands under verbose mode to see where node-gyp fails me, then patch things manually.

I attribute all these weird issues to my using a mix of homebrew node and homebrew nvm, so you may not experience anything like this if your setup is different from mine. But in case you do, hope this helps!

Cheers,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s