mscdex / cap

A cross-platform binding for performing packet capturing with node.js
MIT License
360 stars 46 forks source link

"The specified module could not be found" #90

Closed vincenthawke closed 5 years ago

vincenthawke commented 5 years ago

Windows 10, node version v10.15.3, npcap version 0.995.

I was unable to run a simple code example:

const Cap = require('cap').Cap;
console.dir(Cap.deviceList());

It gives an error:

PS C:\Users\Home1\Desktop\nodecap> node index
internal/modules/cjs/loader.js:730
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Users\Home1\Desktop\nodecap\node_modules\cap\build\Release\cap.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\Home1\Desktop\nodecap\node_modules\cap\lib\Cap.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
PS C:\Users\Home1\Desktop\nodecap>
mscdex commented 5 years ago

Are you sure the addon was compiled successfully when you installed it?

vincenthawke commented 5 years ago

Are you sure the addon was compiled successfully when you installed it?

I deleted all and tried again. Here is the installation console output:

PS C:\Users\Home1\Desktop\nodecap> npm install cap

> cap@0.2.0 install C:\Users\Home1\Desktop\nodecap\node_modules\cap
> node-gyp rebuild

C:\Users\Home1\Desktop\nodecap\node_modules\cap>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  binding.cc
  win_delay_load_hook.cc
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(142): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Home1\Desktop\nodecap\node
_modules\cap\build\cap.vcxproj]
  c:\users\home1\desktop\nodecap\node_modules\nan\nan.h(1024): note: see declaration of 'Nan::MakeCallback'
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(241): warning C4996: 'v8::Value::Uint32Value': was declared deprecated [C:\Users\Home1\Desktop\nodecap
\node_modules\cap\build\cap.vcxproj]
  c:\users\home1\.node-gyp\10.15.3\include\node\v8.h(2477): note: see declaration of 'v8::Value::Uint32Value'
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(291): warning C4996: 'v8::String::Utf8Value::Utf8Value': was declared deprecated [C:\Users\Home1\Deskt
op\nodecap\node_modules\cap\build\cap.vcxproj]
  c:\users\home1\.node-gyp\10.15.3\include\node\v8.h(2891): note: see declaration of 'v8::String::Utf8Value::Utf8Value'
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(292): warning C4996: 'v8::String::Utf8Value::Utf8Value': was declared deprecated [C:\Users\Home1\Deskt
op\nodecap\node_modules\cap\build\cap.vcxproj]
  c:\users\home1\.node-gyp\10.15.3\include\node\v8.h(2891): note: see declaration of 'v8::String::Utf8Value::Utf8Value'
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(293): warning C4996: 'v8::Value::Int32Value': was declared deprecated [C:\Users\Home1\Desktop\nodecap\
node_modules\cap\build\cap.vcxproj]
  c:\users\home1\.node-gyp\10.15.3\include\node\v8.h(2478): note: see declaration of 'v8::Value::Int32Value'
c:\users\home1\desktop\nodecap\node_modules\cap\src\binding.cc(452): warning C4996: 'v8::Value::Uint32Value': was declared deprecated [C:\Users\Home1\Desktop\nodecap
\node_modules\cap\build\cap.vcxproj]
  c:\users\home1\.node-gyp\10.15.3\include\node\v8.h(2477): note: see declaration of 'v8::Value::Uint32Value'
     Creating library C:\Users\Home1\Desktop\nodecap\node_modules\cap\build\Release\cap.lib and object C:\Users\Home1\Desktop\nodecap\node_modules\cap\build\Release\
  cap.exp
  Generating code
  All 253 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
  cap.vcxproj -> C:\Users\Home1\Desktop\nodecap\node_modules\cap\build\Release\\cap.node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN nodecap@1.0.0 No description
npm WARN nodecap@1.0.0 No repository field.

+ cap@0.2.0
added 2 packages from 9 contributors and audited 2 packages in 2.801s
found 0 vulnerabilities

Not sure if this is 100% without problems, it seems to be but I don't know.

mscdex commented 5 years ago

That looks fine. Did you also make sure to check the 'winpcap compatibility' option when you installed npcap?

vincenthawke commented 5 years ago

That looks fine. Did you also make sure to check the 'winpcap compatibility' option when you installed npcap?

That I did not but I remember seeing this last checkbox in wireshark installation process. Let me try reinstalling it...

vincenthawke commented 5 years ago

Works now:) Winpcap compatibility checkbox fixed it: http://prntscr.com/om78fg Thank you!