I'm learning express, and I'm running this code:
var express = require('express');
var app = express();
var port = process.env.PORT || 3000;
app.get('/', function(req, res) {
res.send('<html><head></head><body><h1>Hello World!</h1></body></html>');
});
app.get('/api', function(req,res) {
res.json({ firstname: 'John', lastname: 'Doe'})
});
app.listen(port);
When I try to execute it like this, it works:
node app.js
But when I try to run it this way:
nodemon app.js
This happens:
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:874:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)
What seems to be the problem?