Kiano Jajino
Kiano Jajino5d ago

Cannot make Koffi (npm) work with its module after compile

Hello, I wanted to try reading dll with Koffi but when it's compiled, it doesn't work because it need to access its module. I tried to include them with --include like the Koffi's documentation said https://koffi.dev/packaging but I didn't manage to make it work. I don't know if the issues is from Koffi, Deno or me being a completely idiot... You can easily test it with this code
import koffi from "npm:koffi";
console.log(koffi.config());
import koffi from "npm:koffi";
console.log(koffi.config());
Then compile
deno compile -A main.ts
deno compile -A main.ts
And run it. You should have the error
error: Uncaught (in promise) Error: Cannot find the native Koffi module; did you bundle it correctly?
at init (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:466:15)
at Object.<anonymous> (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:610:12)
at Object.<anonymous> (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:613:4)
at Module._compile (node:module:745:34)
at Object.Module._extensions..js (node:module:762:10)
at Module.load (node:module:662:32)
at Function.Module._load (node:module:534:12)
at Module.require (node:module:681:19)
at require (node:module:818:16)
at file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:7:15
error: Uncaught (in promise) Error: Cannot find the native Koffi module; did you bundle it correctly?
at init (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:466:15)
at Object.<anonymous> (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:610:12)
at Object.<anonymous> (file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:613:4)
at Module._compile (node:module:745:34)
at Object.Module._extensions..js (node:module:762:10)
at Module.load (node:module:662:32)
at Function.Module._load (node:module:534:12)
at Module.require (node:module:681:19)
at require (node:module:818:16)
at file:///C:/Users/M8B0D~1.GRI/AppData/Local/Temp/deno-compile-DenoTest.exe/DenoTest/node_modules/.deno/koffi@2.9.2/node_modules/koffi/index.js:7:15
Thanks for your help
0 Replies
No replies yetBe the first to reply to this messageJoin