Error "Cannot read property 'indexOf' of undefined" binding n-api module Error "Cannot read property 'indexOf' of undefined" binding n-api module vue.js vue.js

Error "Cannot read property 'indexOf' of undefined" binding n-api module


Most probably you are trying to apply method 'indexOf' to variable which isn't defined yet. Take a look at docs https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf . Check if your variable is defined somewhere and it should be an array type.


In the meantime I've tried to import the module without bindings:

const colorBalance = require('../../build/Release/colorBalance.node');

Then I getting a new error:

Error: Cannot open D:\temp\test2\build\Release\colorBalance.node: Error: Module did not self-register.      at Object.eval (webpack:///./build/Release/colorBalance.node?:1:155)      at eval (webpack:///./build/Release/colorBalance.node?:2:30)      at Object../build/Release/colorBalance.node (D:\temp\test2\dist\electron\main.js:97:1)      at __webpack_require__ (D:\temp\test2\dist\electron\main.js:21:30)      at eval (webpack:///./src/main/index.js?:28:20)      at Module../src/main/index.js (D:\temp\test2\dist\electron\main.js:3833:1)      at __webpack_require__ (D:\temp\test2\dist\electron\main.js:21:30)      at eval (webpack:///./src/main/index.dev.js?:11:1)      at Object../src/main/index.dev.js (D:\temp\test2\dist\electron\main.js:3821:1)      at __webpack_require__ (D:\temp\test2\dist\electron\main.js:21:30)

I've rebuild electron using electron-rebuild. I've read about win_delay_load_hook here and tried this but the error doesn't disappear.


I've solved my problem by changing the build chain from cmake to gyp. Compiling with gyp everything works fine.