onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[Build] Cannot read property 'install' of null with onnxruntime-react-native imported

Open ngeor26 opened this issue 1 year ago • 2 comments

Describe the issue

I have the exact same issue as this, which unfortunately didn't get resolved. I tried all the solutions mentioned in the thread and followed the linked guide to no avail. Same as her, when I comment out the import everything runs fine. I also have the second error that she has as well.I also have 10 npm vulnerabilities that cascade when I try to resolve them (5 moderate, 5 high). Here's the repo: Repository

Urgency

I have 2 days to get this going.

Target platform

IOS, Android

Build script

{ "name": "allergyapp", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "expo": "~50.0.6", "expo-camera": "~14.0.4", "expo-media-library": "~15.9.1", "expo-status-bar": "~1.11.1", "onnxruntime-common": "", "onnxruntime-react-native": "", "react": "18.2.0", "react-native": "0.73.4" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }

Error / output

image

Visual Studio Version

No response

GCC / Compiler Version

No response

ngeor26 avatar Feb 13 '24 22:02 ngeor26

Are you able to run the example RN app? That should work without modification if everything is setup correctly.

https://github.com/microsoft/onnxruntime-inference-examples/tree/main/mobile/examples/React_Native/ort-rn-basic-usage

skottmckay avatar Feb 14 '24 00:02 skottmckay

I noticed that in your project/package.json file you are using * for specifying the onnxruntime-react-native npm package version. Have you tried to limit that to a specific version like ^1.16.0? (or even older version)

Also as Scott mentioned, the ort-rn-basic-usage example app can work as expected with the onnxruntime-react-native 1.16.0 version package.

Meanwhile, I'll try to clone your project and see if the same issue can be repro'd on my end.

YUNQIUGUO avatar Feb 14 '24 01:02 YUNQIUGUO

I experienced the same situation in my project. For some unknown reason, the OnnxruntimeJSIHelper couldn't not be extracted from NativeModules.

I had to delete all caches: node_modules, package-lock.json, Podfile.lock, build, ... and rebuild everything to make it working again.

Vibrat avatar Aug 04 '24 13:08 Vibrat

I had to delete all caches: node_modules, package-lock.json, Podfile.lock, build, ... and rebuild everything to make it working again.

This did it for me. Thanks @Vibrat!

Stanley-Jovel avatar Aug 12 '24 19:08 Stanley-Jovel