首页 > 解决方案 > node.js:未处理的承诺拒绝导致 nodemon 不记录错误

问题描述

任何人都可以帮我解决这个问题吗?

 const express = require("express")

 const app = express();
 const port = 1050;
 
 app.get("/", (req, res)=>{
     res.send("This is a homepage of  my  express app with harry bhai");
 });
 
 app.get("/about", (req, res)=>{
     res.send("This is  about pages of my first express app with Harry bhai");
 });
 
 app.post("/about", (req,res)=>{
     res.send("This is post request about pages of my first express app with Harry");
 });
 
 app.listen(port, ()=>{
     console.log(`The application has started successfully on port ${port}`);
 });

我看到以下内容:

PS C:\Users\user\Desktop\Complete Webdevelopment BootCamp\htmlcssjsNodejs\Tut71writingyourfirstExpressApp\Express> nodemon app.js

[nodemon] 2.0.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`

The application has started successfully on port 1050

rs
child_process.js:650
    throw err;
    ^

Error: Command failed: wmic process where (ParentProcessId=5200) get ProcessId 2> nul

PS C:\Users\user\Desktop\Complete Webdevelopment BootCamp\htmlcssjsNodejs\Tut71writingyourfirstExpressApp\Express> nodemon app.js
[nodemon] 2.0.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
The application has started successfully on port 1050
rs
child_process.js:650
    throw err;
    ^

Error: Command failed: wmic process where (ParentProcessId=5200) get ProcessId 2> nul

标签: node.js

解决方案


您是否尝试过使用命令 nodemon app.js 或 nodemon (yourEnteryfile.js) 启动服务器


推荐阅读