WebDevSimplified / Face-Recognition-JavaScript

222 stars 367 forks source link

How do I run this app? #5

Open PrashantSaikia opened 4 years ago

PrashantSaikia commented 4 years ago

I installed all the packages and dependencies with sudo npm install -g nodemon. Then when I want to run the project with node script.js, this is what I get:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/username/Downloads/Face-Recognition-JavaScript-master/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/username/Downloads/Face-Recognition-JavaScript-master/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/username/.npm/_logs/2020-08-24T06_01_03_368Z-debug.log
username@Users-MBP Face-Recognition-JavaScript-master % node script.js
/Users/username/Downloads/Face-Recognition-JavaScript-master/script.js:1
const imageUpload = document.getElementById('imageUpload')
                    ^

ReferenceError: document is not defined
    at Object.<anonymous> (/Users/username/Downloads/Face-Recognition-JavaScript-master/script.js:1:21)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

How do I run this app?

sayannath commented 3 years ago

Have to install all the packages like this npm i?

amouratoglou commented 12 months ago

really? there is not package.json

amouratoglou commented 12 months ago

the way to run is to create a node server to serve the index.html file a quick way:

npx serve then open http://localhost:3000

this could be included in the docs to help others try the example locally.

the index.html file won't resolve well the JS modules maps within an Apache server,