#node.js #node-modules #nodemon
Вопрос:
- Я установил
nodemon
. - Я внес изменения в свой код.
- Он застрял при ПЕРЕЗАПУСКЕ ИЗ-ЗА ИЗМЕНЕНИЙ и не перезапускает сервер.
Почему это происходит и как это решить?
>>index.js
const express = require('express');
const app = express();
app.get('', (req, res) => {
res.send('Hello, world!');
})
app.get('./help', (req, res) => {
res.send('Help Page!');
})
const port = 3000;
// const hostName = '127.0.0.1';
app.listen(port, () => {
console.log(`Server is listening on ${port}`);
});
>>package.json
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" amp;amp; exit 1",
"start": "nodemon index.js"
},
"author": "Sharjeel",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12"
}
}
Ответ №1:
Проблема в последней версии nodemon. Предыдущая или более старая версия работает полностью нормально, не создавая никаких проблем, т. е. nodemon@2.0.7.