Cannot find module dtrace-provider

2019-04-22 18:34发布

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"
  }

7条回答
劫难
2楼-- · 2019-04-22 19:07

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.

查看更多
一夜七次
3楼-- · 2019-04-22 19:08

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.

查看更多
Lonely孤独者°
4楼-- · 2019-04-22 19:11

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 =)

查看更多
霸刀☆藐视天下
5楼-- · 2019-04-22 19:14

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.

查看更多
Explosion°爆炸
6楼-- · 2019-04-22 19:24

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.

查看更多
叛逆
7楼-- · 2019-04-22 19:28

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.

查看更多
登录 后发表回答