Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Failed with "new UnhandledPromiseRejection(reason);" error

未关闭
#21 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript, node.js, react, vite
领域
cli, tooling

调研方向

在 Vite/SWC React 项目中复现 npx create-codeceptjs . --use-yarn,并检查生成的 package 配置和 Yarn postinstall 输出,尤其是关于 react-native 的 Detox 错误。对于一个普通的 React Web 项目,如果安装程序能够完成,且没有未处理的 rejection 或不兼容的 React Native 依赖失败,则视为完成。

由索引模型根据 Issue 内容生成。

描述

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!

主要语言
JavaScript
星标
15
派生
12
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/create-codeceptjs 的其他 Issue

查看 codeceptjs/create-codeceptjs 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。