Niccolo Lubello
Niccolo Lubello

Reputation: 21

Electron node-ffi-napi Error: No native build was found

I'm starting a very basic program which needs to interact with a DLL file but I'm getting this error:

Error: No native build was found for platform=win32 arch=x64 runtime=electron abi=89 uv=1 libc=glibc node=14.16.0 electron=13.6.9 webpack=true loaded from: C:\Coding\cas_utils at Function.load.path (webpack:///./node_modules/node-gyp-build/index.js?:60:9) at load (webpack:///./node_modules/node-gyp-build/index.js?:22:30) at eval (webpack:///./node_modules/ref-napi/lib/ref.js?:8:111) at Object../node_modules/ref-napi/lib/ref.js (C:\Coding\cas_utils\dist_electron\index.js:1806:1) at webpack_require (C:\Coding\cas_utils\dist_electron\index.js:20:30) at eval (webpack:///./node_modules/ffi-napi/lib/ffi.js?:7:13) at Object../node_modules/ffi-napi/lib/ffi.js (C:\Coding\cas_utils\dist_electron\index.js:790:1) at webpack_require (C:\Coding\cas_utils\dist_electron\index.js:20:30) at eval (webpack:///./src/CAS_DLL.js?:1:11) at Object../src/CAS_DLL.js (C:\Coding\cas_utils\dist_electron\index.js:2096:1)

The file where I'm importing the module ffi-napi is very basic at the moment:

var ffi = require("ffi-napi");
var libloc = "\\CAS DLL\\AlfaCalcInterface.dll";
const ces = ffi.Library(libloc, {
  'SetDatabaseDir': ['int', [ 'char *']],
});

and my vue.config.js file is this one:

const { defineConfig } = require('@vue/cli-service')
const nodeExternals = require('webpack-node-externals');

module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    externals: [nodeExternals({
      allowlist: [/^(?!(^(ffi-napi)$)).*$/i]
    })],
  }
})

Node version is 16.14.2 and npm 8.5.0

My question is how can I understand if it's a DLL loading error or it's the node ffi library which does not have correct binaries?

Upvotes: 2

Views: 714

Answers (0)

Related Questions