Kiano Jajino
Kiano Jajino
DDeno
Created by Kiano Jajino on 11/15/2024 in #help
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
1 replies
DDeno
Created by Kiano Jajino on 11/14/2024 in #help
Try to use node-opcua-client (npm) with Deno but struggle
Hello, I want to try to migrate a little app to Deno because the compile option suit my need and that now it support npm package. I want to use the npm package node-opcua-client but I've got this error message
error: Uncaught (in promise) DataError: 'key_ops' property of JsonWebKey is invalid
at importKeyRSA (ext:deno_crypto/00_crypto.js:3849:17)
at importKeyInner (ext:deno_crypto/00_crypto.js:3585:14)
at SubtleCrypto.importKey (ext:deno_crypto/00_crypto.js:989:26)
at buildPublicKey (file:///D:/Code/DenoTest/node_modules/.deno/node-opcua-crypto@4.12.0/node_modules/node-opcua-crypto/dist/index.js:2026:42)
at eventLoopTick (ext:core/01_core.js:175:7)
at async createSelfSignedCertificate (file:///D:/Code/DenoTest/node_modules/.deno/node-opcua-crypto@4.12.0/node_modules/node-opcua-crypto/dist/index.js:6203:21)
error: Uncaught (in promise) DataError: 'key_ops' property of JsonWebKey is invalid
at importKeyRSA (ext:deno_crypto/00_crypto.js:3849:17)
at importKeyInner (ext:deno_crypto/00_crypto.js:3585:14)
at SubtleCrypto.importKey (ext:deno_crypto/00_crypto.js:989:26)
at buildPublicKey (file:///D:/Code/DenoTest/node_modules/.deno/node-opcua-crypto@4.12.0/node_modules/node-opcua-crypto/dist/index.js:2026:42)
at eventLoopTick (ext:core/01_core.js:175:7)
at async createSelfSignedCertificate (file:///D:/Code/DenoTest/node_modules/.deno/node-opcua-crypto@4.12.0/node_modules/node-opcua-crypto/dist/index.js:6203:21)
NodeOPCUA creates automatically a default certificate when a client is first started. But my guess is either the symlink deno create for node_modules cause the issues or a permission missing but I already run the project using -A. I don't have this with Node Can you help me troubleshooting this ?
4 replies