“[nodemon] clean exit - 在重启前等待更改”:尝试启动服务器时
Posted
技术标签:
【中文标题】“[nodemon] clean exit - 在重启前等待更改”:尝试启动服务器时【英文标题】:"[nodemon] clean exit - waiting for changes before restart": while trying to start the server 【发布时间】:2022-01-20 09:55:58 【问题描述】:我在尝试运行我的代码时一直遇到这个错误...
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
[nodemon] clean exit - waiting for changes before restart
这是我要运行的代码:
import app from "./server";
import mongodb from "mongodb";
import dotenv from "dotenv";
//configuiring dotenv for use
dotenv.config();
const MongoClient = mongodb.MongoClient;
const port = process.env.PORT || 8000; // if the port(5000 in this one) from dotenv file cant be accesed then access 8000
MongoClient.connect(process.env.RESTREVIEWS_DB_URI,
poolsize: 50, //max no of users at a time
wtimeout: 2500, //timeout after 2500 ms
useNewUrlParse: true,
)
.catch((err) =>
//if connection fails
console.error(err.stack);
process.exit(1);
)
.then(async (client) =>
app.listen(port, () =>
console.log(`listening on the port $port`);
);
);
// -- AND WE ARE DONE WITH THE DATABASE AND HAVE STARTED OUR WEB SERVER --
我尝试将执行策略更改为无限制模式和远程,但它仍然不起作用。如果有人能帮我弄清楚我做错了什么,那就太好了!
【问题讨论】:
运行node server.js
时会发生什么? Nodemon 有时会中断,这可能是问题所在。
Nothing... 它只是在运行node server.js
时提示输入下一个输入
【参考方案1】:
尝试将 nodemon 版本恢复到 1.2.1 将解决问题。
【讨论】:
不起作用...它显示此错误消息:exception in nodemon killing node ReferenceError: primordials is not defined
以上是关于“[nodemon] clean exit - 在重启前等待更改”:尝试启动服务器时的主要内容,如果未能解决你的问题,请参考以下文章