node.js - 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
解决方案
您是否尝试过使用命令 nodemon app.js 或 nodemon (yourEnteryfile.js) 启动服务器
推荐阅读
- mongodb - Does querying certain fields only save query time in mongodb?
- java - Passing values to java program from a command line, how does it work?
- c# - Binding DropdownList with a nested json result
- python - How to combine two LSTM layers with different input sizes in Keras?
- swift - TableViewCell does not get data in Swift
- android - What does QUERY_ALL_PACKAGES permission do?
- mysql - Mysql Create VIEW with CONCAT and two colums
- reactjs - 如何在 Object.keys 中获取除某个键之外的所有键?
- android - 引起:java.lang.Exception:无法识别命令`config`
- c - 当我尝试编译 libburn 中的测试文件夹时,Gcc 抛出错误