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

Created on 17 Nov 2016  路  38Comments  路  Source: yarnpkg/yarn

I'm using version 0.17.3. If I run npm install everything works fine. The problem only shows up when I do yarn install.

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?

After doing yarn install and start a development server with webpack and react-hot-loader, I get a bunch of module not found issues like this:

{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/alansouza/repo/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3) code: 'MODULE_NOT_FOUND' }

What is the expected behavior?

Module is found and no error is printed

Please mention your node.js, yarn and operating system version.

Node 6.9.1
NPM 3.10.9

Most helpful comment

I did some sleuthing to get to the bottom of this, and I'm happy to report it's not really yarn's fault. There are a handful of issues with dtrace-provider that could break things in interesting ways.

The first issue is with the dtrace-provider install script and how it runs node-gyp. It looks for the node-gyp binary in a few predefined locations, which, depending on your environment, may fail or find the wrong binary. This is likely why some people are having problems under nvm or nodenv (although my nodenv setup seems to work).

If it fails to find node-gyp, it just bails. The exit code is zero, so yarn has no idea the command failed and just keeps on truckin. That explains why everything seems to work at compile time. It will also explicitly exit with code 0, even if the build failed. So again, yarn thinks everything's fine.

Then, the runtime js module actually catches the require() error when it can't find the native module. It just logs the Error: Cannot find module './build/default/DTraceProviderBindings' warning and carries on.

Things get hairier with node >= 6 and [email protected], because dtrace-provider depends on nan@^2.0.8. If you just yarn add [email protected] in a new project, you'll get [email protected], which works fine. But if you already have a dep on nan that has resolved to some version < 2.2.x, you'll get the following error when building dtrace-provider: ../../nan/nan.h:590:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'. Upgrading to dtrace-provider@^0.7.0 ensures it gets a working nan version.

So, yarn seems to be doing the right thing. The biggest problem is that dtrace-provider is silencing its errors completely. If it didn't, yarn would have at least told you it failed. In my case, I only have an optional dep on it anyway, so that would have been great. I'll file some issues in that repo to address all that.

Where yarn could have been more helpful is with build logging (#2204). I had to run a hacked version of yarn just to get the build output to understand what was going on.

All 38 comments

Same behaviour here.

Full error message

{ Error: Cannot find module './build/Release/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/commons-express/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/commons-express/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/commons-express/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Release/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/bunyan-logstash-tcp/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/bunyan-logstash-tcp/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/bunyan-logstash-tcp/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }

Looks like the issue hasn't been resolved yet?
I have the same issue.
Mac OX@Sierra 10.12.3
[email protected]
[email protected]

I believe this happens when there are two different versions of dtrace-provider as dependencies. Use yarn list to print a full graph of dependencies. In my project I had sub-dependencies of dtrace-provider 0.6.0 & 0.8.0

yarn appears to only build ONE of those dependencies and does not build the other.

Same behavior here

E/configParser - Error code: 105
[15:17:20] E/configParser - Error message: failed loading configuration file conf.js
[15:17:20] E/configParser - Error: Cannot find module 'C:\Users\priyanka.pasalkar\Desktopng2-e2e-testing-tutorial
-masterng2-e2e-testing-tutorial-master\conf.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at ConfigParser.addFileConfig (C:\Users\priyanka.pasalkar\AppData\Roamingnpmnode_modules\protractor\built\co
nfigParser.js:123:26)
at Object.initFn [as init] (C:\Users\priyanka.pasalkar\AppData\Roamingnpmnode_modules\protractor\built\launc
her.js:92:22)
at Object. (C:\Users\priyanka.pasalkar\AppData\Roamingnpmnode_modules\protractor\built\cli.js:209
:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)

For anyone who's interested, I managed to resolve this issue by downgrading my node version from [email protected] to node@6 and it started working for me...

Interesting. I am running on [email protected] currently and I am seeing this issue. I added the package passport and passport-facebook. I removed both dependencies and added them back. Now the dtrace-provider error has mysteriously disappeared.

same issue appears me

yarn: 0.17.9
node: 6.9.1
os: mac 10.12.1

For those who are still having this issue, I was able to resolve it by switching to the native version of Yarn (@0.19.1 as of posting, installed via homebrew) instead of the global npm module.

I was also using nvm at the time to install/manage my node versions, so I decided to wipe node/nvm from my system and install node with homebrew instead. That seemed to do the trick.

Here is my current system:
[email protected]
[email protected]
[email protected]
[email protected]

I just had similar errors when running jest tests for a new yarn install. yarn cache clean && rm -rf node_modules && yarn appears to have mysteriously resolved them.. tests run clean now..

  console.error node_modules/dtrace-provider/dtrace-provider.js:26
    { Error: Cannot find module './build/Release/DTraceProviderBindings' from 'dtrace-provider.js'

[email protected]
[email protected]
[email protected]

@lecstor Just followed your steps yarn cache clean && rm -rf node_modules && yarn. I still get the error mentioned in the comments above.
But I do have two different versions of dtrace-providerin the dependencies (as mentioned here)

[email protected] and
[email protected]

I will try to change this and comment the results here.

[email protected]
[email protected]
[email protected]

I did some sleuthing to get to the bottom of this, and I'm happy to report it's not really yarn's fault. There are a handful of issues with dtrace-provider that could break things in interesting ways.

The first issue is with the dtrace-provider install script and how it runs node-gyp. It looks for the node-gyp binary in a few predefined locations, which, depending on your environment, may fail or find the wrong binary. This is likely why some people are having problems under nvm or nodenv (although my nodenv setup seems to work).

If it fails to find node-gyp, it just bails. The exit code is zero, so yarn has no idea the command failed and just keeps on truckin. That explains why everything seems to work at compile time. It will also explicitly exit with code 0, even if the build failed. So again, yarn thinks everything's fine.

Then, the runtime js module actually catches the require() error when it can't find the native module. It just logs the Error: Cannot find module './build/default/DTraceProviderBindings' warning and carries on.

Things get hairier with node >= 6 and [email protected], because dtrace-provider depends on nan@^2.0.8. If you just yarn add [email protected] in a new project, you'll get [email protected], which works fine. But if you already have a dep on nan that has resolved to some version < 2.2.x, you'll get the following error when building dtrace-provider: ../../nan/nan.h:590:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'. Upgrading to dtrace-provider@^0.7.0 ensures it gets a working nan version.

So, yarn seems to be doing the right thing. The biggest problem is that dtrace-provider is silencing its errors completely. If it didn't, yarn would have at least told you it failed. In my case, I only have an optional dep on it anyway, so that would have been great. I'll file some issues in that repo to address all that.

Where yarn could have been more helpful is with build logging (#2204). I had to run a hacked version of yarn just to get the build output to understand what was going on.

I find dtrace-provider poorly following SemVer. Every version of it is actually a breaking change. But they keep iterating over 0.*, for which SemVer is saying:

Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

And there are like hundreds (or thousands) modules depending on "initial development" dtrace-provider package. Sadly.

Maybe you can do this~ @chenyaoli19
$ npm install hexo --no-optional
if it doesn't work
try
$ npm uninstall hexo-cli -g
$ npm install hexo-cli -g

I resolve this issue by run following command, remove dtrace-provider and re-install hexo-cli with sudo

$ sudo npm uninstall hexo-cli -g
$ sudo npm uninstall dtrace-provider -g
$ sudo npm install hexo-cli -g --no-optional

It happened to me right now and I believe it happens when you do this:

藴/clean-project
yarn
node index.js # no problem
yarn cache clean
node index.js # shows errors from this issue

Maybe because those dtrace provider modules where cached and shared somehow.

This seems related to another issue with tap-consumer https://github.com/yarnpkg/yarn/issues/886 , because when I manually run yarn install from dtrace-provider it fails with error

max$ yarn install
yarn install v0.24.3
info No lockfile found.
[1/4] 馃攳  Resolving packages...
[2/4] 馃殮  Fetching packages...
[3/4] 馃敆  Linking dependencies...
error Couldn't find a package.json file in "/src/dtrace-provider/node_modules/tap/node_modules/tap-consumer"

@xibuka thanks. it work for me

For anyone got this error, I fixed it by install node-gyp globally.

yarn global add node-gyp
yarn 

The error 's gone. I guess it's the easiest way.

P.s: if you're installed node-gyp global already, try to remove it first.

I was using pyenv and had to run pyenv rehash and remove node_modules and then yarn install to fix the error in my case.

Removing /node_modules (installed with npm) and installing via yarn solved this for me. Node v7.10.0 (v8.1.4 still threw errors even with yarn).

No matter which workaround in this issue I tried, it still failed so now I resort to a manual npm rebuild after using yarn.

this time I'm rid of the errors after

rm -rf node_modules
rm yarn.lock
yarn

Hey all,

I really need two things so we can address this issue:

  • Someone willing to provide exact, isolated reproduction steps. I read the whole thread and couldn't find a single comment stating the proper steps to reproduce this issue although I see a bunch of "me too"s. I'm not even sure if these are really the same issues :D
  • May be that same someone, trying the latest nightly to see if this is already fixed since there have been a lot of fixes since the reported versions of Yarn here.

It seems to be fixed with the last version of dtrace-provider.

I updated my dtrace-provider from 0.8 to 0.8.5 and the error is gone.

Yay, thanks @davidfirst

@davidfirst i haven't had to manually do anything with dtrace-provider in the past.

are you saying you just did something like below?:

npm i -g dtrace-provider 

@tony-kerz nope. It wasn't installed globally for me. It was a dependency of another package I'm using.
I just updated the lock file and it automatically chose the latest version of dtrace-provider, which is currently 0.8.5

I fixed this by removing my yarn.lock file and having yarn reinstall all my modules from package.json.

same issue with
[email protected]
[email protected]
[email protected]
Sails.[email protected]
[email protected]

{ Error: Cannot find module './build/Release/DTraceProviderBindings'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
...
at Module._compile (module.js:573:30) code: 'MODULE_NOT_FOUND' }

I suspect many people may have slightly different issues which all surface as the same thing.

In my case, the solution was to make sure I was using Python 2.7 (and not Python 3). Hope that helps someone!

@xdissent Thanks for your thorough breakdown of the problem. In order to get the errors resolved, I had to ensure that [email protected] had node-gyp available before being installed as a (optional) dependency by running:

yarn global add node-gyp
rm -rf node_modules yarn.lock
yarn install

dtrace-provider then successfully builds its native code, meaning the modules are actually available which ensures the require() call doesn't fail, and so on.

Ideally, this "failure" to build would be more obvious and yarn would report this. I see that other issues related to this problem mention yarn's --verbose mode as a solution, but the sheer amount of information outputted means any errors will just be lost in the noise.

I have a not very good idea.
use v6.x.x Node.js can solve this problem.
and, use the nvm control the Node.js version. Like this:

npm install nvm -g
nvm install 6.12.0
nvm use 6.12.0

It's work for me.

rm -rf node_modules
npm intall 

I had this same issue and just ran npm rebuild dtrace-provider and it fixed everything.

Still seeing the error, got rid of it by:

rm -rf node_modules and npm install --no-optional

andrea-f your solution worked for me. Thanks

For me working fine in app root:

rm -rf node_modules \
npm install --no-optional

reference in and of page in : @baseprime https://github.com/baseprime/dynamodb/issues/50#issuecomment-603197190

Was this page helpful?
0 / 5 - 0 ratings