Nodemon 给出一个问题
Nodemon giving an issue
- 我安装了
nodemon
。
- 我更改了我的代码。
- 卡在RESTARTING DUE TO CHANGES,没有重启服务器。
为什么会出现这种情况,如何解决?
>>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\" && exit 1",
"start": "nodemon index.js"
},
"author": "Sharjeel",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12"
}
}
问题出在最新版本的 nodemon 上。以前或更旧的版本运行完全正常,没有任何问题,即 nodemon@2.0.7.
- 我安装了
nodemon
。 - 我更改了我的代码。
- 卡在RESTARTING DUE TO CHANGES,没有重启服务器。
为什么会出现这种情况,如何解决?
>>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\" && exit 1",
"start": "nodemon index.js"
},
"author": "Sharjeel",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12"
}
}
问题出在最新版本的 nodemon 上。以前或更旧的版本运行完全正常,没有任何问题,即 nodemon@2.0.7.