Fix Node JS Samples (#23581)

### Description
The Node JS Samples included in the repository have outdated package
references that are broken, which are fixed in this PR.

### Motivation and Context
The samples included in this repository should just work, but sadly do
not. The reason is that they are using very outdated references for the
npm modules. This fix updates the dependencies to the current
onnxruntime-node, which fixes the samples. Also adds a small update to
the .gitignore to exclude the node_modules directories in the samples
directory, which keeps the local repo changelist cleaner.
This commit is contained in:
Jon Campbell 2025-02-04 19:50:29 -08:00 committed by GitHub
parent 6b4f9c481d
commit cd8775f518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 7 deletions

View file

@ -1,2 +1,3 @@
!**/*.onnx
package-lock.json
package-lock.json
node_modules

View file

@ -1,5 +1,5 @@
'use strict';
const ort = require('onnxruntime');
const ort = require('onnxruntime-node');
// use an async context to call onnxruntime functions.
async function main() {

View file

@ -7,6 +7,6 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"onnxruntime": "0.0.1-dev.20200429.2"
"onnxruntime-node": "^1.20.1"
}
}

View file

@ -1,5 +1,5 @@
'use strict';
const Tensor = require('onnxruntime').Tensor;
const Tensor = require('onnxruntime-node').Tensor;
//
// create a [2x3x4] float tensor

View file

@ -7,6 +7,6 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"onnxruntime": "0.0.1-dev.20200429.2"
"onnxruntime-node": "^1.20.1"
}
}

View file

@ -1,7 +1,7 @@
'use strict';
const fs = require('fs');
const util = require('util');
const InferenceSession = require('onnxruntime').InferenceSession;
const InferenceSession = require('onnxruntime-node').InferenceSession;
// use an async context to call onnxruntime functions.
async function main() {

View file

@ -7,6 +7,6 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"onnxruntime": "0.0.1-dev.20200429.2"
"onnxruntime-node": "^1.20.1"
}
}