Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]Bug in lib\logger.ts #20

Open
refer5h opened this issue Dec 27, 2024 · 1 comment
Open

[Bug]Bug in lib\logger.ts #20

refer5h opened this issue Dec 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@refer5h
Copy link

refer5h commented Dec 27, 2024

错误描述
清晰而简洁的描述一下遇到的 Bug 。
when build the project, console reported "ERROR in E:\Code\tsCode\hamibot-starter\src\lib\logger.ts(384,11)
TS2339: Property 'captureStackTrace' does not exist on type 'ErrorConstructor'."

错误复现
产生 Bug 的代码或要复现 Bug 需要进行的操作(这有助于尽快定位问题)。
just build the project.

git clone xxx
pnpm run build

行为预期
清晰而简明的描述一下你期望这段代码或进行的操作产生的结果。
it should build successfully.

截图
1

机器人型号(请填写以下信息):

  • 设备型号:[例如:Redmi Note 11T Pro+]
  • 操作系统:[例如:Xiaomi Hyper OS 1.0.3.0.ULOCNXM]
  • Hamibot 版本:[例如:1.6.1]

其他说明
The problem is related with the API of higher version Hamibot, has nothing to do with the telephone.

@refer5h refer5h added the bug Something isn't working label Dec 27, 2024
@batu1579
Copy link
Owner

batu1579 commented Jan 3, 2025

看起来这个问题和node的版本有关系。

应该可以用类型声明来跳过这个检查,毕竟这个用法不是所有JS引擎都支持的。但是我在Hamibot上测试可以正常使用。

你可以试试下面的步骤:

  1. src 文件夹里创建一个新的文件夹 types
  2. 在这个新文件夹中创建一个名叫 global.d.ts 的类型声明文件。
  3. 将下面的代码添加到类型声明文件中:
interface ErrorConstructor {
  captureStackTrace?: (targetObject: any, constructorOpt?: Function) => void;
}
  1. 删除目前有的 node_modules 文件夹。
  2. 重新执行 npm install 命令。

无论是否有效果都请告诉我,等你回复~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants