onnxruntime
onnxruntime copied to clipboard
Error with finding onnxruntime_binding.node on Windows 10 on a bootcamp Macbook
Describe the issue
When I try to run some basic onnxruntime code in a basic node 18 project on Windows 10 bootcamp on a macbook , I get the following error:
App threw an error during load
Error: The specified module could not be found.
\\?\C:\Users\samto\Desktop\reor\node_modules\onnxruntime-node\bin\napi-v3\win32\x64\onnxruntime_binding.node
at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:2238)
at Module._extensions..node (node:internal/modules/cjs/loader:1356:18)
at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2238)
at Module.load (node:internal/modules/cjs/loader:1126:32)
at Module._load (node:internal/modules/cjs/loader:967:12)
at l._load (node:electron/js2c/asar_bundle:2:13642)
at Module.require (node:internal/modules/cjs/loader:1150:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (C:\Users\samto\Desktop\reor\node_modules\onnxruntime-node\dist\binding.js:9:1)
at Module._compile (node:internal/modules/cjs/loader:1271:14)
To reproduce
Create a basic node 18 project on windows 10 bootcamp machine from a macbook. And try running the following code:
const ort = require("onnxruntime-node");
async function main() {
try {
// Load the ONNX model (make sure to provide the correct path to your model)
const session = await ort.InferenceSession.create(
"C:UserssamtoDownloadssqueezenet1.0-7.onnx"
);
// Create a tensor for input (adjust the size and data according to your model's requirements)
// Example: Creating a dummy input tensor
const inputTensor = new ort.Tensor(
"float32",
new Float32Array(1 * 3 * 224 * 224),
[1, 3, 224, 224]
);
// Run the model with the tensor (replace 'inputName' with your model's actual input name)
const feeds = { inputName: inputTensor };
const results = await session.run(feeds);
// Process the output (replace 'outputName' with your model's actual output name)
const outputTensor = results.outputName;
console.log(`Model output: ${outputTensor.data}`);
} catch (error) {
console.error("Error during ONNX session:", error);
}
}
main();
Urgency
No response
Platform
Windows
OS Version
10
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.16.3
ONNX Runtime API
JavaScript
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
npm install onnxruntime-node
if your machine doesn't have it.
Yes I do do that. The above error occurs after doing the npm install you mention...
Hi @samlhuillier you need to install this https://aka.ms/vs/17/release/vc_redist.x64.exe
onnxruntime-node require you to have MSVS C++ redist
Hi @samlhuillier you need to install this https://aka.ms/vs/17/release/vc_redist.x64.exe
onnxruntime-node require you to have MSVS C++ redist
does that will work on the deployed server after that? Like, should I install or configure something on the vercel, to make sure that onnxruntime-node would work?