bnoordhuis / node-buffertools

working with node.js buffers made easy
ISC License
205 stars 35 forks source link

Error: Cannot find module './build/Debug/buffertools.node #88

Closed jcald1 closed 7 years ago

jcald1 commented 7 years ago

We upgraded to Node 6.9.1 and started getting the following error when running our application when we require buffertools. We're using version buffertools 2.1.4.

2017-04-03T14:41:07.847-05:00 - ^[[31merror^[[39m: uncaughtException: Cannot find module './build/Debug/buffertools.node' date=Mon Apr 03 2017 14:41:07 GMT-0500 (CDT), pid=25362, uid=7401, gid=7400, cwd=/u01/app/myappapps/myapp/src/myapp, execPath=/u01/app/myappapps/node/node-v6.9.1-linux-x64/bin/node, version=v6.9.1, argv=[/u01/app/myappapps/node/node-v6.9.1-linux-x64/bin/node, /u01/app/myappapps/myapp/src/myapp/bin/server.js, --NODE_CONFIG_DIR=/u01/app/myappapps/myapp/config/myapp], rss=64241664, heapTotal=62951424, heapUsed=35376392, loadavg=[0.55615234375, 0.5693359375, 1.3642578125], uptime=2143553, trace=[column=15, file=module.js, function=Function.Module._resolveFilename, line=469, method=Module._resolveFilename, native=false, column=25, file=module.js, function=Function.Module._load, line=417, method=Module._load, native=false, column=17, file=module.js, function=Module.require, line=497, method=require, native=false, column=19, file=internal/module.js, function=require, line=20, method=null, native=false, column=20, file=/u01/app/myappapps/myapp/src/myapp/node_modules/buffertools/buffertools.js, function=, line=26, method=null, native=false, column=32, file=module.js, function=Module._compile, line=570, method=_compile, native=false, column=10, file=module.js, function=Object.Module._extensions..js, line=579, method=Module._extensions..js, native=false, column=32, file=module.js, function=Module.load, line=487, method=load, native=false, column=12, file=module.js, function=tryModuleLoad, line=446, method=null, native=false, column=3, file=module.js, function=Function.Module._load, line=438, method=Module._load, native=false], stack=[Error: Cannot find module './build/Debug/buffertools.node',     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> (/u01/app/myappapps/myapp/src/myapp/node_modules/buffertools/buffertools.js:26:20),     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)]
2

buffertools/buffertools.js:

try {
        var buffertools = require('./build/Release/buffertools.node');
} catch (e) {
        var buffertools = require('./build/Debug/buffertools.node');
}

The statement in the catch block is line 26. It's looking for the buffertools.node file in /u01/app/myappapps/myapp/src/myapp/node_modules/buffertools/build/Release and that file is there.

jcald1 commented 7 years ago

It turns out that there was an exception due to a Node.js version mismatch. I suggest adding a log statement to that catch block.

bnoordhuis commented 7 years ago

Not a bad idea. Done in 1648d39, released in v2.1.5.