Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker Errror : Error: no available backend found. ERR: [wasm] TypeError: n(...).dirname is not a function #12665

Closed
juliangdz opened this issue Aug 20, 2022 · 4 comments
Assignees
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@juliangdz
Copy link

juliangdz commented Aug 20, 2022

Hi i need some help on this issue.

I have a react-app built using create-react-app that loads the onnx models and does inference fine . The react app works fine .

However my issue is encountered when i try to Create a Webview Application using electronjs with the react-app . The onnx backend wasm was loaded fine and the worker scripts loads the models and did inference when i use the script

"start": "set BROWSER=none&&react-scripts start",
"start-electron": "set ELECTRON_START_URL=http://localhost:3000&&electron .",

Running npm run start and npm run start-electron in different terminals brings up the Developer Version of the Electron-react application and everything works fine without error .

However i get the following error when i Try to package the Electron-React Application . I first run the build script to build the react app and copy my electron files to the build folder. Then i run the script

"package": "set ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true&&electron-builder build -c.extraMetadata.main=build/electron/main.js --publish never",

This creates a dist with the .exe.

The following error is what i see in the devtools console

Worker Eerrror : Error: no available backend found. ERR: [wasm] TypeError: n(...).dirname is not a function
at inference-session-impl.js:170:39
at async h.create (backend-impl.js:51:31)

I use ort.min.js and its files all exist in the public folder along with the wasm* files .

Please provide some insight into this , i have tried a few methods trying to understand if its a issue with my package.json by checking my build files path , but i have overcome those issues by adding "homepage": "./",

@baijumeswani baijumeswani added the platform:web issues related to ONNX Runtime web; typically submitted using template label Aug 22, 2022
@baijumeswani
Copy link
Contributor

@fs-eire @shalvamist for more info.

@juliangdz
Copy link
Author

juliangdz commented Aug 22, 2022 via email

@baijumeswani
Copy link
Contributor

Thanks @juliangdz. I'll close this issue. @shalvamist @fs-eire Do we need to update our documentation for this use case?

@cassiebreviu
Copy link
Contributor

Thanks @juliangdz. I'll close this issue. @shalvamist @fs-eire Do we need to update our documentation for this use case?

I documented it here a while ago: https://onnxruntime.ai/docs/tutorials/web/classify-images-nextjs-github-template.html#nextconfigjs

Are we able to fix this issue in the package? It is a problem that has come up many times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

5 participants