-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
undefined is not a constructor #1976
Comments
Hi @FladioArmandika, Could you please share your code. Assuming its more an import error, Please recheck your imports. Thanks! |
i also try is there anything wrong? |
Hi! Can you try using "@mediapipe/face_detection": "^0.3" in your dependencies? The package.json I was using was in shambles. Also, to save you time, if you didn't already see this, you'll need to change locateFile to grab the files from your npm_modules. Something like:
|
Hi @FladioArmandika, Have a look at the above comment. Thanks! |
I change to ^0.3 and change the locateFile but still got the same error like before :( |
I also get the same issues with Pose. Have changed my initialization to
but I get the same I don't see any examples of importing from the npm-installed libraries anywhere... not sure if I'm doing this right? |
I'm getting the same issues here with pose. Has anyone fixed this? |
This almost certainly means that you have not successfully loaded the
wasm.js file. You can see whether or not this happens by looking at the
network tab.
I am surprised that the following does not work.
const pose = new Pose({
locateFile: (file) => {
return ***@***.***/pose/${file}`;
}
});
This is how some of our internal teams have set this up. Make sure that
when you are running your web server, that ***@***.***/pose/
${file}` actually gets you the files you need. e.g., Angular might
serve these files from `static`.
I recognize that we have a lot of npm users out there, and I will see about
putting together some examples.
…On Wed, Jul 28, 2021 at 7:13 PM Ariya Sontrapornpol < ***@***.***> wrote:
I'm getting the same issues here with pose. Has anyone fixed this?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#1976 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHKQBFKVELLEMT47RYADXZ3T2C2M3ANCNFSM44CCMJPA>
.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
Hi @FladioArmandika, Were you able to load the wasm.js files as mentioned in the above comment. Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
Closing as stale. Please reopen if you'd like to work on this further. |
I am getting the same issue with the pose, has anyone found any solution for it? |
Having this issue with face_mesh |
I've the same issue with face_mesh (version ^0.4.1633559619)
In dev mode all things work but in production this appear :
Maybe all of this come from the fact that the source code is an IIFE. |
It's great that the types are included in the package, but it required a lot of troubleshooting and a weird workaround to get them to actually work. The window props are perfectly functional, but if I try to import the equivalent values, I get errors like "undefined is not a function" or "Holistic is not a constructor" even though the types say it should be fine. The workaround is to grab the functional window props and reassign the types manually.
|
I experienced the same thing where it works fine in Vite's dev server but not after building for both hands and camera_utils. Using this as a workaround:
Might have something to do with the package.json referencing And, unrelated to this issue, I'd prefer if the library somehow made these files available and remove the dependance on a CDN, but maybe that violates the license?
|
You can use the updated @mediapipe/tasks-vision api which works properly in vite locally and in production. Over at Kinetix ML we have it working locally with vite and in production with vercel deploy after facing similar issues with the face landmarks api. You can checkout our implementation here https://github.com/Kinetix-ML/kml-pipe-ts/blob/main/src/operations/faceMeshDetect.ts |
Thanks! It works on my case. I use Vue with Vite. Works well on dev but got '"Hands" is not a constructor' on preview after build.
It put the error '"Hands" is not exported by hand.js'. By the way, there has a same issue on Vite: same issue on Vite. |
i use
npm install @mediapipe/face_detection
and import
import { FaceDetection } from '@mediapipe/face_detection'
andimport { FaceDetection } from '@mediapipe/face_detection/face_detection';
and do
let faceDetection = new FaceDetection();
but it tells me
undefined is not a constructor (evaluating 'new _face_detection.FaceDetection()')
would you help me? or give some example for implementing it?
The text was updated successfully, but these errors were encountered: