segment-anything icon indicating copy to clipboard operation
segment-anything copied to clipboard

DEMO WARNING: Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Open WCH-Jason opened this issue 1 year ago • 5 comments

This warning occurred after I built and ran yarn, and I asked GPT that it could be ignored if it did not affect the operation of the project, but after I turned off the warning, nothing could be displayed on the web page (blank page) 屏幕截图 2024-10-08 145249 屏幕截图 2024-10-08 151802 屏幕截图 2024-10-08 151922

WCH-Jason avatar Oct 08 '24 07:10 WCH-Jason

Did you figure this out?

Beasleydog avatar Oct 10 '24 03:10 Beasleydog

i got the same problem

moersxm avatar Oct 12 '24 15:10 moersxm

+1, same problem

whut-zhangwx avatar Oct 21 '24 16:10 whut-zhangwx

The solution is to update package.json to use "onnxruntime-web": "1.14.0", (rather than "onnxruntime-web": "^1.14.0", as it is in the repo). This will ensure v1.14.0 to be installed. Then rerun yarn to install the right version of the package. I also find that the onnx needs to be exported with onnx==1.13.1 and onnxruntime==1.13.1 rather than the latest versions of these two packages. These two are python packages that can be installed with pip.

TonyLianLong avatar Nov 01 '24 07:11 TonyLianLong

@TonyLianLong This helped me!

In addition, when I use python 3.12 and numpy 2.x, this demo didn't work. But when I use python 3.10.5 and numpy 1.23.3, it worked.

takerfume avatar Nov 07 '24 12:11 takerfume