microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.82k stars 2.94k forks source link

"npm install" throws an error. Can not install onnxruntime for nodejs #5829

Closed weingaunity closed 3 years ago

weingaunity commented 4 years ago

Describe the bug I try to get onnxruntime running with nodejs. But the installation process terminates with an error.

Urgency Need this for a project at university where i have to work on. I have to run onnx models in nodejs (not browser).

System information

To Reproduce Open terminal within an empty directory. Execute: npm install onnxruntime@0.0.1-dev.20200429.2

Expected behavior npm install runs without error and const ort=require("onnxruntime") can be executed without any error.

Screenshots (base) ###@###-ThinkPad-W541:/######/40_NodeInference$ npm install npm ERR! code 1 npm ERR! path /##############/40_NodeInference/node_modules/onnxruntime npm ERR! command failed npm ERR! command sh -c prebuild-install -r napi || (tsc && node ./script/build) npm ERR! Version 4.0.5 npm ERR! Syntax: tsc [options] [file...] npm ERR! npm ERR! Examples: tsc hello.ts npm ERR! tsc --outFile file.js file.ts npm ERR! tsc @args.txt npm ERR! tsc --build tsconfig.json npm ERR! npm ERR! Options: npm ERR! -h, --help Print this message. npm ERR! -w, --watch Watch input files. npm ERR! --pretty Stylize errors and messages using color and context (experimental). npm ERR! --all Show all compiler options. npm ERR! -v, --version Print the compiler's version. npm ERR! --init Initializes a TypeScript project and creates a tsconfig.json file. npm ERR! -p FILE OR DIRECTORY, --project FILE OR DIRECTORY Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. npm ERR! -b, --build Build one or more projects and their dependencies, if out of date npm ERR! -t VERSION, --target VERSION Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. npm ERR! -m KIND, --module KIND Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. npm ERR! --lib Specify library files to be included in the compilation. npm ERR! 'es5' 'es6' 'es2015' 'es7' 'es2016' 'es2017' 'es2018' 'es2019' 'es2020' 'esnext' 'dom' 'dom.iterable' 'webworker' 'webworker.importscripts' 'scripthost' 'es2015.core' 'es2015.collection' 'es2015.generator' 'es2015.iterable' 'es2015.promise' 'es2015.proxy' 'es2015.reflect' 'es2015.symbol' 'es2015.symbol.wellknown' 'es2016.array.include' 'es2017.object' 'es2017.sharedmemory' 'es2017.string' 'es2017.intl' 'es2017.typedarrays' 'es2018.asyncgenerator' 'es2018.asynciterable' 'es2018.intl' 'es2018.promise' 'es2018.regexp' 'es2019.array' 'es2019.object' 'es2019.string' 'es2019.symbol' 'es2020.bigint' 'es2020.promise' 'es2020.string' 'es2020.symbol.wellknown' 'es2020.intl' 'esnext.array' 'esnext.symbol' 'esnext.asynciterable' 'esnext.intl' 'esnext.bigint' 'esnext.string' 'esnext.promise' npm ERR! --allowJs Allow javascript files to be compiled. npm ERR! --jsx KIND Specify JSX code generation: 'preserve', 'react-native', or 'react'. npm ERR! -d, --declaration Generates corresponding '.d.ts' file. npm ERR! --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. npm ERR! --sourceMap Generates corresponding '.map' file. npm ERR! --outFile FILE Concatenate and emit output to single file. npm ERR! --outDir DIRECTORY Redirect output structure to the directory. npm ERR! --removeComments Do not emit comments to output. npm ERR! --noEmit Do not emit outputs. npm ERR! --strict Enable all strict type-checking options. npm ERR! --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. npm ERR! --strictNullChecks Enable strict null checks. npm ERR! --strictFunctionTypes Enable strict checking of function types. npm ERR! --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. npm ERR! --strictPropertyInitialization Enable strict checking of property initialization in classes. npm ERR! --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. npm ERR! --alwaysStrict Parse in strict mode and emit "use strict" for each source file. npm ERR! --noUnusedLocals Report errors on unused locals. npm ERR! --noUnusedParameters Report errors on unused parameters. npm ERR! --noImplicitReturns Report error when not all code paths in function return a value. npm ERR! --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. npm ERR! --types Type declaration files to be included in compilation. npm ERR! --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. npm ERR! @ Insert command line options and files from a file.

npm ERR! A complete log of this run can be found in: npm ERR! /home/###/.npm/_logs/2020-11-17T06_46_11_523Z-debug.log

Additional context none

weingaunity commented 4 years ago

Can someone please provide a working installation routine how to get onnxruntime working with nodejs.

Thx.

weingaunity commented 4 years ago

I tried it on Windows10 again with following output:

grafik

weingaunity commented 3 years ago

Hi, i will ask again if anyone can give me an advice or tip to solve this. Thx.

hariharans29 commented 3 years ago

CC: @fs-eire

weingaunity commented 3 years ago

@fs-eire I'm still not able to get this package installed. Same errors as above. Can you please provide me an instruction how i can get this run locally on my device (Ubuntu 20.04).

Thx. Klaus

weingaunity commented 3 years ago

@fs-eire

Today i tried again with windows:

grafik

Please provide a running installation instruction.

Thx, Klaus

weingaunity commented 3 years ago

So i got it run with following steps:

git clone --recursive https://github.com/Microsoft/onnxruntime
cd onnxruntime
./build.sh --config RelWithDebInfo --build_nodejs --parallel

To run the samples i changed e.g. within the file samples/nodejs/01_basic-usage/package.json the dependencies to following:

  "dependencies": {
    "onnxruntime": "../../../nodejs/"
  }

and called within the 01_basic-usage directory following lines:

  npm install
  node ./index.js

Maybe you can fix the npm package so that following way to install and use the package will work too:

  npm install onnxruntime

Thx, Klaus