Skip to content

Failed with "new UnhandledPromiseRejection(reason);" error #21

Open
@acyment

Description

@acyment

I am using npx create-codeceptjs . --use-yarn in a React project created with Vite using SWC. I had barely added a couple of dependencies. After that I ran the aforementioned code and I received the following error:

➤ YN0000: └ Completed in 29s 664ms
➤ YN0000: · Failed with errors in 1m 5s
node:internal/process/promises:389
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<Object>".
    at throwUnhandledRejectionsMode (node:internal/process/promises:389:7)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32) {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.17.0

The log contains the following:

# This file contains the result of Yarn building a package (detox@virtual:b9d026221b6ccf869e6d11f2b48ce0b8c57b8019f0c9d219cace198e95e746647dd8655694a089c347671f2cf32e0f278e26b7a94b2cc75061efff0c4e6ae31b#npm:20.18.1)
# Script name: postinstall

/Users/acyment/dev/cyment-timer/.pnp.cjs:19551
      Error.captureStackTrace(firstError);
            ^

Error: detox tried to access react-native, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: react-native (via "react-native/package.json")
Required by: detox@virtual:b9d026221b6ccf869e6d11f2b48ce0b8c57b8019f0c9d219cace198e95e746647dd8655694a089c347671f2cf32e0f278e26b7a94b2cc75061efff0c4e6ae31b#npm:20.18.1 (via /Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/src/utils/rn-consts/)

Require stack:
- /Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/src/utils/rn-consts/rn-consts.js
- /Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/scripts/updateGradle.js
- /Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/scripts/postinstall.js
    at require$$0.Module._resolveFilename (/Users/acyment/dev/cyment-timer/.pnp.cjs:19551:13)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at require$$0.Module._load (/Users/acyment/dev/cyment-timer/.pnp.cjs:19442:31)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at parseRNVersion (/Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/src/utils/rn-consts/rn-consts.js:2:23)
    at Object.<anonymous> (/Users/acyment/dev/cyment-timer/.yarn/unplugged/detox-virtual-4250b31ea8/node_modules/detox/src/utils/rn-consts/rn-consts.js:11:3)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at require$$0.Module._extensions..js (/Users/acyment/dev/cyment-timer/.pnp.cjs:19594:33)

Node.js v20.17.0

I will be using plain React for web, not react native

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions