node.js - nodemon 向我显示此错误如何解决?
问题描述
"scripts": {
"start": "node server.js",
"server": "nodemon server.js"
},
将此添加到我的 package.json 中,然后运行npm run server
它启动的 commond,nodemon server.js
但在重新启动时它向我显示此错误
[nodemon] restarting due to changes...
(node:17784) UnhandledPromiseRejectionWarning: Error: Command failed: wmic process where (ParentProcessId=24008) get ProcessId 2> nul
at checkExecSyncError (child_process.js:616:11)
at execSync (child_process.js:652:15)
at kill (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:337:26)
at Function.run.kill (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:425:7)
at Bus.<anonymous> (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:495:7)
at Bus.emit (events.js:327:22)
at restartBus (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\watch.js:228:7)
at FSWatcher.filterAndRestart (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\watch.js:212:16)
at FSWatcher.emit (events.js:315:20)
at FSWatcher.emitWithAll (C:\Users\shreya\AppData\Roaming\npm\node_modules\nodemon\node_modules\chokidar\index.js:540:8)
(node:17784) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
这是我的 server.js 代码
解决方案
尝试更新 nodemon
npm i nodemon --global
推荐阅读
- c# - 无法更新 userinfo TenantToken 或 userToken 超时值
- c# - Newtonsoft JSON 转换器序列化:在 writeJson() 中,如何修改值并避免递归到自身?
- sql-server - 如何在 SQL Server 中使用实体框架代码优先迁移更新 NVARCHAR(MAX) 列?
- javascript - HTML 视频标签正在暂停某些 mp4 的播放
- google-cloud-platform - 如何获取 google-cloud-ops-agent 日志记录以识别特殊的“严重性”字段
- function - 我如何使用这些功能来为比赛打分?
- sql - 检查 SQL Server 表之间的数据等价性
- python - 在 POP!_os 中将 Tensorflow 添加到 PATH 时出错(类似于 Ubuntu)
- r - 如何在 Rmarkdown 中运行循环并为列中的每个唯一值生成 pdf?
- python - Tensorflow Keras 模型不学习且准确性极低