vladmandic / face-api

FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
https://vladmandic.github.io/face-api/demo/webcam.html
MIT License
827 stars 149 forks source link

Unable to use faceapi in a nexjs - react application "Module not found: Can't resolve 'fs'" #42

Closed karthik-Gopalan closed 3 years ago

karthik-Gopalan commented 3 years ago

Issue Description Getting the following error:

error - ./node_modules/@vladmandic/face-api/dist/face-api.esm.js:8:25031 Module not found: Can't resolve 'fs'

Steps to Reproduce create a nextjs application as given here:

https://nextjs.org/learn/basics/create-nextjs-app/setup

added face api packages (npm install). Including tensorflow Invoked the api to load the models: await faceapi.nets.ssdMobilenetv1.loadFromUri('/models')

And got the error:

Expected Behavior It should have loaded the models.

**Environment Windows 10. Nodejs. React application. Using VS code editor. Browser is chrome/Edge.

Additional

vladmandic commented 3 years ago

NextJS is a server-side-rendering framework and you're loading client-side browser module - so this usage is creating a hybrid?

What comes to mind: