Answer the question
In order to leave comments, you need to log in
Node.js: how to stop webserver?
Good evening!
I'm using the gulp-server-livereload plugin !
var server = require('gulp-server-livereload');
gulp.src(pathDir).pipe(server({
livereload: true,
directoryListing: true,
open: true,
port: 80
}));
Uncaught Error: watch C:\OpenServer\domains\ipcRenderer\node_modules\electron\dist\resources\electron.asar\browser ENOENT
at exports._errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1316 :19)
at Object.fs.watch (fs.js:1341:11)
at watch (C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:221:8)
at C :\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:230:9
at C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:41 :14
at Array.forEach (native)
at C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:38:18
at ReaddirReq.Req.done (C:\OpenServer\domains\FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:143:5)
at ReaddirReq.done (C:\OpenServer\ domains\FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:90:22)
at ELECTRON_ASAR.js:568:9
at _combinedTickCallback (internal/process/next_tick.js:67:7 )
at process._tickCallback (internal/process/next_tick.js:98:9)
exports._errnoException @ util.js:1022
FSWatcher.start @ fs.js:1316
fs.watch @ fs.js:1341
watch @ C:\ OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:221
(anonymous) @ C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:230
(anonymous) @ C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:41
(anonymous) @ C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib \watch.js:38
Req.done @ C:\OpenServer\domains\FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:143
ReaddirReq.done @ C:\OpenServer\domains \FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:90
(anonymous) @ ELECTRON_ASAR.js:568
_combinedTickCallback @ internal/process/next_tick.js:67
_tickCallback @ internal/process/ next_tick.js:98
fs.js:1318 Uncaught Error: watch C:\OpenServer\domains\FM\FrontMonkey\node_modules\electron\dist\resources\electron.asar\browser ENOENT
at exports._errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1316:19)
at Object.fs.watch (fs.js:1341:11)
at watch (C:\OpenServer\domains \FM\FrontMonkey\node_modules\node-watch\lib\watch.js:221:8)
at C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:230:9
at C :\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\lib\watch.js:41:14
at Array.forEach (native)
at C:\OpenServer\domains\FM\FrontMonkey\node_modules\node-watch\ lib\watch.js:38:18
at ReaddirReq.Req.done (C:\OpenServer\domains\FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:143:5)
at ReaddirReq.done (C:\OpenServer\domains\FM\FrontMonkey\node_modules\temp-write\node_modules\graceful-fs\graceful-fs.js:90:22)
at ELECTRON_ASAR.js:568:9
at _combinedTickCallback (internal /process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Answer the question
In order to leave comments, you need to log in
Judging by the sources, the server stops through the "kill" event.
Try:
const stream = server({
livereload: true,
directoryListing: true,
open: true,
port: 80
});
gulp.src(pathDir).pipe(stream);
stream.emit('kill');
if you can’t find it in the dock, then process.exit() will solve your problem for sure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question