Node-bunyan: Cannot find module './build/Release/DTraceProviderBindings'

Created on 2 Aug 2017  ยท  11Comments  ยท  Source: trentm/node-bunyan

I just installed the latest version and now I'm getting this error:

{ Error: Cannot find module './build/Release/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    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/leyboan1/dev/search-api/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    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/leyboan1/dev/search-api/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:470:15)
    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/leyboan1/dev/search-api/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3) code: 'MODULE_NOT_FOUND' }

This is what npm list shows me:

โ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚   โ””โ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”€ [email protected]

Most helpful comment

@aleybovich This is due to the dtrace-provider dependency failing to install. If you reinstall with V=1 in your environment, you can see why it's failing to build:

% rm -rf node_modules/bunyan && V=1 npm install bunyan

There are usually several different causes:

  • You don't have a C/C++ compiler toolchain installed.
  • You have Python 3 instead of Python 2 in your environment, which causes problems with node-gyp. You can do npm install --python=python2.7 (or whatever the name of your Python 2 executable is) or set the PYTHON environment variable to fix this.
  • If you're on Mac OS X, then you may need to agree to the XCode license (this will manifest as a warning that looks like Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.). You should be able to fix this by running sudo xcodebuild -license.

If none of these apply, let me know what the output with V=1 is.

(I'd also like to improve or remove the warning message as I've described in chrisa/node-dtrace-provider#96, but haven't had a chance to work on that yet.)

All 11 comments

@aleybovich This is due to the dtrace-provider dependency failing to install. If you reinstall with V=1 in your environment, you can see why it's failing to build:

% rm -rf node_modules/bunyan && V=1 npm install bunyan

There are usually several different causes:

  • You don't have a C/C++ compiler toolchain installed.
  • You have Python 3 instead of Python 2 in your environment, which causes problems with node-gyp. You can do npm install --python=python2.7 (or whatever the name of your Python 2 executable is) or set the PYTHON environment variable to fix this.
  • If you're on Mac OS X, then you may need to agree to the XCode license (this will manifest as a warning that looks like Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.). You should be able to fix this by running sudo xcodebuild -license.

If none of these apply, let me know what the output with V=1 is.

(I'd also like to improve or remove the warning message as I've described in chrisa/node-dtrace-provider#96, but haven't had a chance to work on that yet.)

Didn't give any errors:

1z [andrey:~/dev/search-api] rm -rf node_modules/bunyan && V=1 npm install bunyan
[email protected] /Users/andrey/dev/search-api
โ”œโ”€โ”€ [email protected] 
โ””โ”€โ”€ UNMET PEER DEPENDENCY [email protected]
npm WARN [email protected] No repository field.

Ah, sorry. It looks like npm may have installed dtrace-provider directly in your node_modules directory, and not in node_modules/bunyan/node_modules. If so, you'll want to do this instead:

% rm -rf node_modules/dtrace-provider && V=1 npm install dtrace-provider

(Or just blow away the entire node_modules directory and then install.)

I got this error:

1z [andrey:~/dev/search-api] V=1 npm install    

> [email protected] install /Users/leyboan1/dev/search-api/node_modules/dtrace-provider
> node scripts/install.js

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/andrey/.local/share/npm/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/7.7.3/bin/node" "/Users/leyboan1/.local/share/npm/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/leyboan1/dev/search-api/node_modules/dtrace-provider
gyp ERR! node -v v7.7.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

I'm running this on Mac

When running the xcode license command above, I get:

1z [andrey:~/dev/search-api] sudo xcodebuild -license
Password:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

@aleybovich So, I'm not entirely sure why you're getting that error since pointing my XCode at /Library/Developer/CommandLineTools seems to work without issue, but if I understand it correctly, I think that node-gyp is detecting that you have all of Xcode installed and trying to use xcodebuild, but your installation is pointing at /Library/Developer/CommandLineTools. I would try going through the following steps:

  • Make sure that XCode is installed, by running sudo xcode-select --install
  • Check what it's currently pointing at via xcode-select -p
  • Check to see if the /Applications/Xcode.app/Contents/Developer directory exists
  • Update XCode to point at that via sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

At that point I think that you should be able to rebuild your node_modules.

@melloc This really helped me, thanks for the help!

@falcoagustin Glad to help!

I'm going to close this issue since as of [email protected], this message will no longer be printed to stderr at runtime, and the stub implementation will be used instead. If you want to use bunyan -p or write your own DTrace scripts to process Bunyan logs, then you can set NODE_DTRACE_PROVIDER_REQUIRE=hard during installation to force the build to fail and see why it failed. For example:

$ NODE_DTRACE_PROVIDER_REQUIRE=hard npm install

Beyond what's already been mentioned in this issue, there is a list of common failure reasons in dtrace-provider's README. Please take a look there first before opening any bugs.

This worked for me on OSX Mojave:

rm -rf node_modules/bunyan && npm install bunyan

Ah, sorry. It looks like npm may have installed dtrace-provider directly in your node_modules directory, and not in node_modules/bunyan/node_modules. If so, you'll want to do this instead:

% rm -rf node_modules/dtrace-provider && V=1 npm install dtrace-provider

Thanks a lot, you are my hero, it solved the problem on my macOS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trentm picture trentm  ยท  11Comments

kbirger picture kbirger  ยท  4Comments

ronkorving picture ronkorving  ยท  5Comments

yelworc picture yelworc  ยท  5Comments

raine picture raine  ยท  4Comments