我的测试是正确的,但我一直收到一个UnhandledPromiseRejectionWarning。请对如何解决这个问题有什么想法吗?我尝试过许多解决办法,但似乎都没有效果。
node:32535) UnhandledPromiseRejectionWarning: Error: expect(received).toMatchObject(expected)
Matcher error: received value must be a non-null object
Received has value: undefined (node:32535) UnhandledPromiseR
我正在尝试运行命令npm run build。我搞错了
`make i info Invoking build target
make i info Invoking dist/build target
(node:15892) UnhandledPromiseRejectionWarning: undefined
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15892) UnhandledPromiseRejectionWarning: Unhandled promise reje
我有一个方法getModel(kind),它在NodeJS中返回一个数据存储数据模型。
我在getModel(kind)方法中做了一个简单的类型-o,这揭示了一个潜在的问题,没有明确的承诺拒绝。
我怎样才能更新代码,以便在将来捕获这些未被察觉的异常?
Call getModel:
//Save the data to the database
getModel('transferrequest').create(TransferRequestNew, (err, savedData) => {
if (err) {
console.log('Transfe
我如何在SSR上实现缓存,因为他们提到了app.renderToHTML()缓存不起作用,显然,Next.js已经使Next.js过时了,不能与getServerSideProps函数一起使用,并且在缓存函数中使用app.render(),而缓存函数中总是会出现未定义和中断的情况。
(node:20872) UnhandledPromiseRejectionWarning: TypeError: argument entity is required
at etag (C:\xampp\htdocs\next-app\node_modules\etag\index.js:72:11)
at C
我正在尝试用chai,sinon和chai promise写一个单元测试。以下是我的代码 import chai, { expect } from "chai";
import chaiAsPromised from "chai-as-promised";
import dotenv from "dotenv";
import { request, response } from "express";
import { describe, it } from "mocha";
import sinon from
我需要在我得到的JS对象上运行一个断言。这里的问题是,即使我的断言失败了,测试仍然被证明是通过的;我如何修复它?
代码:
var expect = require('chai').expect
const sslCertificate = require('get-ssl-certificate')
describe('ssl certificate verification',()=>{
it('verifies the issuer of the certificate',()=>{
我试图运行以下命令:
node index.js
然而,我从我的终端得到以下信息:
success connection to port 3000
(node:16767) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError
: connect ECONNREFUSED 127.0.0.1:27017]
at Pool.<anonymous> (/Us
我正在关注youtube上的NodeJs教程,但是当涉及到通过id删除用户时,它的工作方式并不像教程中的那样。但在这段视频里,一切似乎都是完美的。这是我的密码。我哪里错了?期待大家的评论。
let deleteUserByID = (userId)=>{
return new Promise(async(resolve, reject)=>{
try{
let user = await db.User.findOne({
where: {id: userId}
})
我有一些mocha/chai/chai测试,它们遵循下面的结构,但是,每当一个测试失败时,我都会得到一个UnhandledPromiseRejectionWarning,但我似乎找不出它的来源。
UnhandledPromiseRejectionWarning:未经处理的拒绝承诺。此错误起源于在异步函数中抛出而不带catch块,或者拒绝使用.catch()处理的承诺。
describe('indexData', () =>{
it('Should return status code 200 and body on valid request
消息和跟踪:
Generating browser application bundles (phase: building)...(node:5312) UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList
at new Worker (internal/worker.js:170:17)
at SassWorkerImplementation.createWorker (C:\Users\shail\iacade
db connection error querySrv ENOTFOUND _mongodb._tcp.nodeapi.vlvom.mongodb.net
(node:7720) UnhandledPromiseRejectionWarning: Error: querySrv ENOTFOUND _mongodb._tcp.nodeapi.vlvom.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:203:19)
(Use `node --trace-warnings ...` to show where
在克隆react-admin回购之后,我正在努力使本地环境正常工作。
我试图在文档的指导下运行make install和make build,但这对我来说是行不通的。
我在全球安装make。yarn,npm和nodejs都是最新的.
我在Windows-10上使用Visual和PowerShell终端。
这就是我得到的..。
make install返回:
make i info Invoking install target
(node:7316) UnhandledPromiseRejectionWarning: undefined
(node:7316) UnhandledPro