13

I have a simple nodejs application that is throwing "Cannot find module './build/Release/DTraceProviderBindings'". I look it up online and it looks like that a lot of people are having the same problem when using restify on windows (which is my case, I'm using restify on windows 10). Apparently, dtrace-provider is a optional module for restify and there is no version of it for windows. So, what I tried so far:

  1. Update node to v6.2.0;
  2. Uninstall all modules and run npm install --no-optional;
  3. Uninstall only restify and run npm install restify --no-optional;
  4. And my most desperate move npm install dtrace-provider.

Everything I tried where found on github issues, I've seen same error on OSX users with other modules. Not sure what else to try.

Note: This exception does not stop my application, not even prints the error on the console, I just notice that this was happening using the debugger, in other words, my application runs fine, but this keeps happening on the background.

List of other modules I'm using:

"dependencies": {
    "restify": "latest",
    "request":  ">=2.11.1",
    "cheerio":  ">=0.10.0",
    "xml2js":   ">=0.2.0",
    "botbuilder": "^0.11.1",
    "applicationinsights": "latest"
  }
Bruno Brant
  • 8,226
  • 7
  • 45
  • 90
Ernani
  • 1,009
  • 3
  • 15
  • 26

9 Answers9

13

This worked for me after switching to Node 6.1 (and when re-installing node modules didn't work):

  1. Install and save dtrace-provider

    $ npm install dtrace-provider --save
    
  2. Delete 'node_modules' folder

  3. Re-install node modules

    $ npm install
    

I found this thread before combining your attempts with another solution on the Github project issues for restify (https://github.com/restify/node-restify/issues/1093) and simplified best as possible.

Steve Hynding
  • 1,799
  • 1
  • 12
  • 22
6

I recently ran into this error as well on node 6.11.1. I ran npm rebuild dtrace-provider and that resolved the problem.

Derek
  • 1,735
  • 17
  • 14
2

The restify team followed an approach of trying to load the module by requiring it on a try/catch block. You should just ignore the exception.

Bruno Brant
  • 8,226
  • 7
  • 45
  • 90
2

I had success with the following (elaborate) sequence:

  1. Adjust my path to not have spaces
  2. rm -rf node_modules
  3. rm -rf ~/Library/Caches/node-gyp/
  4. npm cache clean --force
  5. V=1 npm install -S dtrace-provider@0.8.8 --python=python2.7 (repeat this step, resolving as you go, until the install is completely successful … if it fails, check the version - I had rogue dtrace-provider@0.6.0 building at one point)
  6. npm install
  7. At this point everything should have installed cleanly, and I was congratulating myself on a job well done. Then I executed my code and still got the DTraceProviderBindings error. The cause was nested dependencies with the wrong version of dtrace-provider (especially bunyan).
  8. To confirm, do npm list | grep dtrace -B6.
  9. If there's anything lower than 0.8.8, edit package-lock.json, following the method in How do I override nested NPM dependency versions?. Replace requires with dependencies for dtrace-provider and update the version.
  10. Back round to get everything clean: rm -rf node_modules
  11. Then, again, npm install --python=python2.7

I had to iterate round npm list a few times because I thought I'd caught everything and I hadn't.

The key points were to use the required version of python, have a unix-friendly path, and hunt down all nested dependencies. The python version issues gave a big messy error, the space issue gave a much more missable error.

Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
Holly Cummins
  • 10,767
  • 3
  • 23
  • 25
1

I know this is an old issue but I wanted to comment on it in case anyone else has the same issue I had.

My issue was caused by having parentheses in my path. /users/karlgroves/Dropbox (Personal)/foo/bar/bat/project...

Moving the project to a path without the parens worked for me. You'll need to wipe out node_modules and reinstall again.

1

I recently ran into this error as well on node v8.8.1 as @Derek mentioned, I ran npm rebuild dtrace-provider and that resolved the problem.

Shlomi Lachmish
  • 541
  • 5
  • 14
1

tl;dr; dtrace-provider utilized node-gyp which required python version >= 2.5 and NOT 3.5

I had this issue on OSX and found a post that showed using environment variable V=/Users/your_user/your_project npm i dtrace-provider

This let me know that there was a dependency on node-gyp that was failing to build...Once I knew the issue was with this module was able to focus my attention at troubleshooting node-gyp.

This led to some log output indicating that my python version 3.5 was unsupported and it required version >= 2.5.

Went and downloaded python 2.7.x and checked /usr/bin/python 2.7.x to ensure it was there. Uninstalled the node module that was ultimately requiring this module, then used npm cache clean then reinstalled the module and this time it appeared to pick up the right python version to be able to build.

Hope this helps someone =)

afreeland
  • 3,889
  • 3
  • 31
  • 42
0

I have tried many suggestions but get the same error again.
Finally, I found the correct way to solve this question.
Go the node.js website and download the latest version of node.js pkg.
After installed, reinstall your software, everything will be ok.

mistdon
  • 1,773
  • 16
  • 14
0

i managed to get this working by running this command

npm install --python=python2.7
gmansour
  • 889
  • 8
  • 8