【发布时间】:2021-11-11 06:17:38
【问题描述】:
- 我安装了
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\" && exit 1",
"start": "nodemon index.js"
},
"author": "Sharjeel",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12"
}
}
【问题讨论】:
标签: node.js node-modules nodemon