Node-bunyan: dtrace errors on npm install

Created on 11 May 2017  ·  24Comments  ·  Source: trentm/node-bunyan

node v6.10.3
npm 3.10.10

{ 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> (/Users/lu35/workspace/app-storelocator/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] (/Users/lu35/workspace/app-storelocator/node_modules/babel-register/lib/node.js:166: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> (/Users/lu35/workspace/app-storelocator/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] (/Users/lu35/workspace/app-storelocator/node_modules/babel-register/lib/node.js:166: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> (/Users/lu35/workspace/app-storelocator/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] (/Users/lu35/workspace/app-storelocator/node_modules/babel-register/lib/node.js:166:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }

Most helpful comment

When will this be fixed?
It is simply modifying package.json from:
"dtrace-provider": "~0.8", to:
"dtrace-provider": "^0.8.5",

All 24 comments

I got the same, installing with yarn

Same here

I managed to resolve this issue by modifying yarn.lock file (ok, I know I shouldn't be doing this, but hey):

bunyan@^1.8.10:
  version "1.8.10"
  resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.10.tgz#201fedd26c7080b632f416072f53a90b9a52981c"
  optionalDependencies:
    dtrace-provider "~0.8" // remove this line
    moment "^2.10.6"
    mv "~2"
    safe-json-stringify "~1"

Also, remove the top-level dtrace-provider section in yarn.lock altogether. Then,

$ rm -rf node_modules
$ yarn

Apparently, bunyan tries to import dtrace-provider and continues without it if it fails:

// ...
try {
    dtrace = require('dtrace-provider' + '');
} catch (e) {
    dtrace = null;
}

I just published [email protected], which includes the fix for chrisa/node-dtrace-provider#95, and can be installed using the latest yarn.

Thank you @melloc

@melloc Sorry, I still get this:

{ Error: Cannot find module './build/Release/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function._module2.default._resolveFilename (/Users/jamessherry/sites/cd3/node_modules/require-hacker/babel-transpiled-modules/require hacker.js:442:34)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jamessherry/sites/cd3/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/jamessherry/sites/cd3/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:488:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function._module2.default._resolveFilename (/Users/jamessherry/sites/cd3/node_modules/require-hacker/babel-transpiled-modules/require hacker.js:442:34)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jamessherry/sites/cd3/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/jamessherry/sites/cd3/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:488:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function._module2.default._resolveFilename (/Users/jamessherry/sites/cd3/node_modules/require-hacker/babel-transpiled-modules/require hacker.js:442:34)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jamessherry/sites/cd3/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/jamessherry/sites/cd3/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:488:32) code: 'MODULE_NOT_FOUND' }
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
s { PaymentDetails: 'styles__PaymentDetails-3gSD7',
  _style: '/* colours */\n/* Black on White */\n/* paddings */\n/* margins */\n/* .sr-only{}.sr-only-focusable:active,.sr-only-focusable:focus{} */\n.styles__PaymentDetails-3gSD7 {\n  background-color: #fff;\n  color: #000;\n  text-align: left;\n  border: none;\n  padding: 35px;\n}\n' }
==> 🌎  Listening at http://localhost:3000
webpack building...

From your package.json:

"version": "0.8.3",

node: v7.10.0
yarn: 0.24.6

@jmsherry Did you blow away your node_modules folder and reinstall? If so, and you're still getting the error:

  • Do you have the same issue if you use npm?
  • Can you run V=1 yarn install --verbose? That should give you the compiler output, and hopefully show the step that's failing.

@melloc

  • Yes, I rimraf'd ;)
  • No, it works ok with npm
  • There's a HUGE amount of output (beyond my console's limit).
  • There's no obvious failure

Sorry, that's not a fat load of good, I know but...

@jmsherry I've tried installing the dependencies of a repo that pulls in bunyan and dtrace-provider multiple times, and I think that I'm seeing the same issue. After installation, I see the following:

% find node_modules/ -name dtrace-provider -exec json -f {}/package.json version \; -exec ls -ld {}/build/Release/ \;                                  
0.8.3
ls: node_modules//changefeed/node_modules/restify-clients/node_modules/bunyan/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//cueball/node_modules/dtrace-provider/build/Release/: No such file or directory
0.6.0
drwxr-xr-x  5 cody.mello  staff  170 Jun 13 15:11 node_modules//dtrace-provider/build/Release/
0.8.3
ls: node_modules//mname/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//mooremachine/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//moray/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//restify/node_modules/bunyan/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//restify-clients/node_modules/bunyan/node_modules/dtrace-provider/build/Release/: No such file or directory
0.7.1
drwxr-xr-x  5 cody.mello  staff  170 Jun 13 15:11 node_modules//restify-clients/node_modules/dtrace-provider/build/Release/
0.8.3
ls: node_modules//sdc-clients/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
ls: node_modules//sigyan/node_modules/dtrace-provider/build/Release/: No such file or directory
0.8.3
drwxr-xr-x  5 cody.mello  staff  170 Jun 13 15:11 node_modules//wf-client/node_modules/dtrace-provider/build/Release/

It's only running the lifecycle scripts once for each version here: [email protected], [email protected], and [email protected]. The problem seems to be that getTopologicalManifest() only returns a single entry in the set per unique package/version pair. Since this is where the list of directories to run the lifecycle scripts comes from, only 3 of the 12 directories yarn created actually get built.

If you run the same find command, do you see the same thing?

(I've filed an issue for this over at yarnpkg/yarn#3631, so hopefully someone with more yarn knowledge can help understand what needs to be fixed here.)

@melloc Hi Cody,
sorry, was just running the commands: Are they bash commands? (I'm not that great with bash!)
I got:

 % find node_modules/ -name dtrace-provider -exec json -f {}/package.json version \; -exec ls -ld {}/build/Release/ \;
fg: no current job
 ✘ ✝  ~/sites/cd3   master±  find node_modules/ -name dtrace-provider -exec json -f {}/package.json version \; -exec ls -ld {}/build/Release/ \;
find: json: No such file or directory
 ✝  ~/sites/cd3   master± 

but I presume that's because I'm doing something wrong? :(

@jmsherry Ah, sorry. You might need to install json(1) first, with:

% sudo npm install -g json

So that you can run the command on the package.json files.

@melloc

yarn install
yarn install v0.24.6
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
✨  Done in 43.19s.
 ✝  ~/sites/cd3   master±  find node_modules/ -name dtrace-provider -exec json -f {}/package.json version \; -exec ls -ld {}/build/Release/ \;
0.8.3
ls: node_modules//dtrace-provider/build/Release/: No such file or directory
 ✝  ~/sites/cd3   master±  find node_modules -name dtrace-provider -exec json -f {}/package.json version \; -exec ls -ld {}/build/Release/ \;
0.8.3
ls: node_modules/dtrace-provider/build/Release/: No such file or directory

...and there is no build folder in dtrace-provider...

Interesting. So this seems to be different from the problem that I was seeing. Can I check this repo out on github to try and reproduce this?

Sure. It's https://github.com/jmsherry/cd3

I'm just pushing the latest... I'll let you know when it's there...

@melloc
GAH!! I've got a git issue! If you pull that repo and then just add:

import bunyan from 'bunyan';
import bunyanMiddleware from 'bunyan-middleware';

and

const logger = bunyan.createLogger({
  name: 'Clothes Doctor',
  level: 'trace',
});
app.use(bunyanMiddleware({
  headerName: 'X-Request-Id',
  propertyName: 'reqId',
  logName: 'req_id',
  obscureHeaders: [],
  logger,
  additionalRequestFinishData() {
    return { example: true };
  },
}));

in /src/server.js then that should get you the same result...

@jmsherry The module built fine for me:

cody.mello@ashur ~/src/cd3 : master % ls node_modules/dtrace-provider/build/Release
DTraceProviderBindings.node     obj.target

Can you try the following:

cody.mello@ashur ~/src % git clone https://github.com/trentm/node-bunyan.git
Cloning into 'node-bunyan'...
remote: Counting objects: 3742, done.
remote: Total 3742 (delta 0), reused 0 (delta 0), pack-reused 3742
Receiving objects: 100% (3742/3742), 1.40 MiB | 0 bytes/s, done.
Resolving deltas: 100% (2056/2056), done.
cody.mello@ashur ~/src % cd node-bunyan 
cody.mello@ashur ~/src/node-bunyan : master % V=1 yarn install --verbose > debug.out

And then look towards the end of the file, after all of the verbose 8.32 Copying ... lines, for any error messages.

verbose 14.745 cannot locate node-gyp

So, as of yarnpkg/yarn@50c5bf0c, it looks like yarn is supposed to download node-gyp when one isn't present. However, it looks like it only does this when the the "install" script starts with the string "node-gyp", which isn't the case here, since dtrace-provider uses a wrapper script.

Does your node installation not ship with npm, and that ships separately? (I believe that Homebrew ships with a configuration like this.)

I think that you should be able to fix this by running:

% sudo npm install -g node-gyp

I'll have to look into other ways to fix this going forward.

@melloc It's a such long time ago. :D

I install most things with brew, so possibly...

My app is in a docker container, so I guess I'd better be careful. I can just npm i node-gyp before I do the yarn install, right? (If it goes wrong I'll let you know... ;)

Thanks Cody.

@jmsherry If the node that ships with the container comes with a bundled npm, then you should be able to get away w/o the npm install node-gyp. If it doesn't, then that should take care of the problem.

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.

I had a similar issue with Python 3.6 . Switching to Python2.7 fixed the problem for me.

When will this be fixed?
It is simply modifying package.json from:
"dtrace-provider": "~0.8", to:
"dtrace-provider": "^0.8.5",

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mouhong picture mouhong  ·  6Comments

ronkorving picture ronkorving  ·  5Comments

mickaeltr picture mickaeltr  ·  7Comments

officer-rosmarino picture officer-rosmarino  ·  6Comments

marnusw picture marnusw  ·  11Comments