简体   繁体   中英

nodemon is not restart after the changes

nodemon does not restart my server first time it works fine but after changes it does not work.

var http = require('http');

http.createServer (function (request, response){
response.writeHead( 200, {'Content-Type': 'text/plain'} );
response.write("Hello world");
response.end();
}).listen(3000, 'localhost');

console.log('http://localhost:3000');

You can see my console screen.

 f:\NodeJS\01 Hello>nodemon app.js
 [nodemon] 2.0.2
 [nodemon] to restart at any time, enter `rs`
 [nodemon] watching dir(s): *.*
 [nodemon] watching extensions: js,mjs,json
 [nodemon] starting `node app.js`
 Running...
 [nodemon] restarting due to changes...
"scripts": {
    "start": "nodemon app.js"
  },

try adding this to package.json. then save and type "npm start" in the console.

if you dont have package.json initialize your project with "npm innit -y"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM