npm ref could not locate the bindings file error

2019-07-15 05:02发布

问题:

I'm using the package ref in my nodejs project that makes use of electron. But the problem is when I use ref in my JS code, it throws an error that it could not locate the bindings file. Here's the error

Error: Could not locate the bindings file. Tried:

→ C:...\EMVModule.asar\node_modules\ref\build\binding.node → C:...\EMVModule.asar\node_modules\ref\build\Debug\binding.node → C:...\EMVModule.asar\node_modules\ref\build\Release\binding.node → C:...\EMVModule.asar\node_modules\ref\out\Debug\binding.node → C:...\EMVModule.asar\node_modules\ref\Debug\binding.node → C:...\EMVModule.asar\node_modules\ref\out\Release\binding.node → C:...\EMVModule.asar\node_modules\ref\Release\binding.node → C:...\EMVModule.asar\node_modules\ref\build\default\binding.node → C:...\EMVModule.asar\node_modules\ref\compiled\6.5.0\win32\x64\binding.node at bindings (C:...\EMVModule.asar\node_modules\bindings\bindings.js:88:9) at Object. >(C:...\EMVModule.asar\node_modules\ref\lib\ref.js:5:47) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object. >(C:...\EMVModule.asar\node_modules\ffi\lib\ffi.js:6:11)

I tried using electron rebuild as well and I tried to use node-gyp to rebuild but to no use. Is there any way to solve this problem?

Thanks

回答1:

After a lot of trial and error, finally this command did the magic

node-gyp rebuild --target=1.4.0 --arch=x64 --dist-url="https://atom.io/download/atom-shell" --msvs_version=2015