日常项目启动出现问题,在未改动代码的时候,项目启动编译报如下错误
UnhandledPromiseRejectionWarning: ……/node_modules/jsdom/lib/api.js:140
referrer: req.getHeader("referer") ?? undefined
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()
百度尝试无果,代码中并未有很多 new Promise 加了,.catch(()=>{}) 也没有效果
解决方法:
可尝试查看 node 版本
当前版本 node -v : 12.xx.xx
项目中需要的 是 14 以上
切换高版本 node 版本
项目启动正常;