yuanchuan / node-watch

A wrapper and enhancements for fs.watch
https://npm.im/node-watch
MIT License
339 stars 44 forks source link

I got this error at first use lib in nodejs using express #110

Closed taryono closed 3 years ago

taryono commented 3 years ago

const express = require("express"); const bodyParser = require("body-parser"); const cors = require("cors"); const watch = require('node-watch'); const app = express(); watch('/', { recursive: true }, console.log);

when I run app

internal/fs/watchers.js:177 throw error; ^

Error: EPERM: operation not permitted, watch '\Documents and Settings' at FSWatcher.start (internal/fs/watchers.js:169:26) at Object.watch (fs.js:1415:11) at C:\wamp64\www\nodejs-express-sequelize-mysql\node_modules\node-watch\lib\watch.js:397:22

is it just related to permission access ?

yuanchuan commented 3 years ago

Yes! You might not need to watch the whole disk, try to change

watch('/', { recursive: true }, console.log);

to

watch('./', { recursive: true }, console.log);
taryono commented 3 years ago

excelent, It's running good no errors any more...thanks @yuanchuan