Cannot find module dtrace-provider
Asked Answered
L

9

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"
  }
Loraleeloralie answered 31/5, 2016 at 15:40 Comment(7)
I'm having the same issue. I hope somebody has a solution.Yi
I've just tried to remove the whole node_modules directory and then npm install --no-optional and finally it seems that no error is thrown. Have you tried it?Yi
Yeah, i tried that...keep happening for meLoraleeloralie
Your IDE, is it VS Code?Splitlevel
@BrunoBrant yes it isLoraleeloralie
Probably the reason why you're seeing the issue is that you have checked the "All Exceptions" option ticked (under the Debug menu, below "Breakpoints"). If I uncheck it, I no longer get the exception.Splitlevel
I posted an answer for the one has same issue with this, please check #35704227Undercover
T
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.

Thermocouple answered 3/8, 2016 at 7:26 Comment(1)
I wish someone would update the dtrace-provider module - it simply spews out errors on MacOS when installing.Keddah
F
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.

Firooc answered 5/10, 2017 at 16:27 Comment(0)
S
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.

Splitlevel answered 13/9, 2016 at 16:1 Comment(0)
S
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 [email protected] --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 [email protected] 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.

Sheehy answered 27/11, 2019 at 21:6 Comment(0)
P
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.

Phoneme answered 8/9, 2017 at 0:2 Comment(0)
R
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.

Redheaded answered 2/11, 2017 at 12:28 Comment(0)
N
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 =)

Narva answered 4/1, 2018 at 20:46 Comment(0)
M
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.

Misdirection answered 17/10, 2017 at 6:28 Comment(0)
R
0

i managed to get this working by running this command

npm install --python=python2.7
Rosaleerosaleen answered 14/3, 2020 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.