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:
npm install --no-optional
;npm install restify --no-optional
;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"
}
This worked for me after switching to Node 6.1 (and when re-installing node modules didn't work):
Install and save dtrace-provider
$ npm install dtrace-provider --save
Delete 'node_modules' folder
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.
I had success with the following (elaborate) sequence:
rm -rf node_modules
rm -rf ~/Library/Caches/node-gyp/
npm cache clean --force
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)npm install
DTraceProviderBindings
error. The cause was nested dependencies with the wrong version of dtrace-provider (especially bunyan).npm list | grep dtrace -B6
.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.rm -rf node_modules
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.
I recently ran into this error as well on node 6.11.1
.
I ran npm rebuild dtrace-provider
and that resolved the problem.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With