{ re-6ren">
gpt4 book ai didi

node.js - 命令失败 : wmic process after updating npm in Express app

转载 作者:行者123 更新时间:2023-12-04 11:54:48 28 4
gpt4 key购买 nike

在我的 app.js 中,

const app = require("express")();

const port = 3000;

app.get("/", (req, res) => {
res.send("hello world");
});

app.listen(port, () => {
console.log("server running!");
});
我保存/更新 app.js 文件后生成此错误,
(node:4196) UnhandledPromiseRejectionWarning: Error: Command failed: wmic process where (ParentProcessId=5740) get ProcessId 2> nul
at checkExecSyncError (child_process.js:630:11)
at execSync (child_process.js:666:15)
at kill (C:\Users\SANTOSH\Desktop\nodesql\node_modules\nodemon\lib\monitor\run.js:337:26)
at Function.run.kill (C:\Users\SANTOSH\Desktop\nodesql\node_modules\nodemon\lib\monitor\run.js:425:7)
at Bus.<anonymous> (C:\Users\SANTOSH\Desktop\nodesql\node_modules\nodemon\lib\monitor\run.js:495:7)
at Bus.emit (events.js:327:22)
at restartBus (C:\Users\SANTOSH\Desktop\nodesql\node_modules\nodemon\lib\monitor\watch.js:228:7)
at FSWatcher.filterAndRestart (C:\Users\SANTOSH\Desktop\nodesql\node_modules\nodemon\lib\monitor\watch.js:212:16)
at FSWatcher.emit (events.js:315:20)
at FSWatcher.emitWithAll (C:\Users\SANTOSH\Desktop\nodesql\node_modules\chokidar\index.js:540:8)
(node:4196) 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)
Package.json 文件,
{
"name": "nodesql",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "nodemon app.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"mysql2": "^2.2.5",
"sequelize": "^6.6.4",
"sequelize-cli": "^6.2.0"
},
"devDependencies": {
"nodemon": "^2.0.9"
}
}
今天我将我的 npm 更新到 7.19.1,之后我收到了这个错误。否则,它必须对 nodemon 做一些事情。

最佳答案

也许新版本的 nodemon 导致了这种情况。所以,我已经将版本降级到 2.0.7,这对我来说很好用!

npm uninstall nodemon
npm install nodemon@2.0.7 --save-dev

关于node.js - 命令失败 : wmic process after updating npm in Express app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68250987/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com