face-api.js icon indicating copy to clipboard operation
face-api.js copied to clipboard

ts-node faceDetection.js ------- Error: Cannot find module

Open deicool opened this issue 5 years ago • 10 comments

Helllo

I am following the instructions in the link :"https://github.com/justadudewhohacks/face-api.js".

When I run the command "ts-node faceDetection.js", it throws the following error:

Error: Cannot find module 'D:\TECHEXP\face\facerec-js-git\face-api.js\examples\examples-nodejs\node_modules\face-api.js\build\commonjs\index.js'. Please verify that the package.json has a valid "main" entry

I can't seem to find out the root cause. Any directions?

Thank You Deepak

deicool avatar Jan 28 '21 11:01 deicool

Hello

When I run the command "tsc faceDetection.ts"

I get the following error:

tsc faceDetection.ts commons/env.ts:5:26 - error TS2307: Cannot find module 'face-api.js' or its corresponding type declarations.

5 import * as faceapi from 'face-api.js'; ~~~~~~~~~~~~~

commons/faceDetection.ts:1:26 - error TS2307: Cannot find module 'face-api.js' or its corresponding type declarations.

deicool avatar Jan 28 '21 11:01 deicool

i also have the same error

marksamfd avatar Feb 03 '21 11:02 marksamfd

You can find the solution to that problem here: https://github.com/justadudewhohacks/face-api.js/issues/491#issuecomment-569703137. Happy hacking :)

mayankagarwals avatar Feb 03 '21 13:02 mayankagarwals

can't build getting [email protected] build rm -rf ./build && rm -rf ./dist && npm run rollup && npm run rollup-min && npm run tsc && npm run tsc-es6

'rm' is not recognized as an internal or external command, operable program or batch file. npm ERR! code 1 npm ERR! path D:\Programming\face-api.js-2nd npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c rm -rf ./build && rm -rf ./dist && npm run rollup && npm run rollup-min && npm run tsc && npm run tsc-es6

marksamfd avatar Feb 03 '21 14:02 marksamfd

Everything mostly worked for me (I do get a simple error in the command "tsc FaceDetection.ts", but that doesn't stop me from running the next command: "node FaceDetection.js").

@marksamfd : Looks like you are running on Windows. "rm" is typically an Unix command

deicool avatar Feb 03 '21 14:02 deicool

yes what can I do??

marksamfd avatar Feb 03 '21 14:02 marksamfd

yes what can I do??

Can you ignore this error and run the next commands. Does that work?

deicool avatar Feb 03 '21 14:02 deicool

yes what can I do??

Can you ignore this error and run the next commands. Does that work?

yah worked thanks a lot

marksamfd avatar Feb 03 '21 14:02 marksamfd

Hi im always getting this error

image Is there a ways so i can fix this

kyahAndoy avatar Mar 08 '22 05:03 kyahAndoy

sl3@luciano-GrIA:~/face-api.js/examples/examples-nodejs$ ts-node faceDetection.ts Error: Cannot find module '/home/sl3/face-api.js/examples/examples-nodejs/node_modules/face-api.js/build/commonjs/index.js'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:425:19) at Function.Module._findPath (node:internal/modules/cjs/loader:638:18) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27) at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30) at Function.Module._load (node:internal/modules/cjs/loader:871:27) at Module.require (node:internal/modules/cjs/loader:1098:19) at require (node:internal/modules/cjs/helpers:108:18) at Object. (/home/sl3/face-api.js/examples/examples-nodejs/faceDetection.ts:1:1) at Module._compile (node:internal/modules/cjs/loader:1196:14) at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1618:23) { code: 'MODULE_NOT_FOUND', path: '/home/sl3/face-api.js/examples/examples-nodejs/node_modules/face-api.js/package.json', requestPath: 'face-api.js' }

LouisSiuLungLau avatar Aug 30 '23 14:08 LouisSiuLungLau