Version
0.2.0
Description of the issue
After installing @tego/botjs in my Electron project, the application fails to load and throws a "Cannot find native binding" error. The error suggests npm's optional dependency bug, but the issue persists even after cleaning dependencies and re-installing. The core problem is that the native module of @tego/botjs is not compatible with Electron's built-in Node.js environment.
@tego/botjs should be loaded normally in the Electron environment, without native binding missing errors.
Steps to reproduce
Steps to reproduce the behavior:
- Create a new Electron project (my version:
33.4.11)
- Initialize package.json (Node.js version:
25.1.0)
- Install
@tego/botjs via pnpm add @tego/botjs (or npm install @tego/botjs)
- Try to start the Electron app (
pnpm run dev)
- The app crashes with the "Cannot find native binding" error
Logs or error messages
App threw an error during load
Error: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
at file:///E:/code/electron/xunfei-dll-no-server/dist-electron/main-DEyYWW85.js:27093:11
at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async loadApplicationPackage (file:///E:/code/electron/xunfei-dll-no-server/node_modules/.pnpm/electron@33.4.11/node_modules/electron/dist/resources/default_app.asar/main.js:129:9)
at async file:///E:/code/electron/xunfei-dll-no-server/node_modules/.pnpm/electron@33.4.11/node_modules/electron/dist/resources/default_app.asar/main.js:242:9
Environment
- OS: Windows 11
- Node.js Version:
v25.1.0
- Electron Version:
33.4.11
- @tego/botjs Version:
0.2.0
- Package Manager: pnpm
10.20.0
- Electron Builder Version :
25.1.8
Checklist
Version
0.2.0
Description of the issue
After installing
@tego/botjsin my Electron project, the application fails to load and throws a "Cannot find native binding" error. The error suggests npm's optional dependency bug, but the issue persists even after cleaning dependencies and re-installing. The core problem is that the native module of@tego/botjsis not compatible with Electron's built-in Node.js environment.@tego/botjsshould be loaded normally in the Electron environment, without native binding missing errors.Steps to reproduce
Steps to reproduce the behavior:
33.4.11)25.1.0)@tego/botjsviapnpm add @tego/botjs(ornpm install @tego/botjs)pnpm run dev)Logs or error messages
App threw an error during load Error: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory. at file:///E:/code/electron/xunfei-dll-no-server/dist-electron/main-DEyYWW85.js:27093:11 at ModuleJob.run (node:internal/modules/esm/module_job:234:25) at async ModuleLoader.import (node:internal/modules/esm/loader:473:24) at async loadApplicationPackage (file:///E:/code/electron/xunfei-dll-no-server/node_modules/.pnpm/electron@33.4.11/node_modules/electron/dist/resources/default_app.asar/main.js:129:9) at async file:///E:/code/electron/xunfei-dll-no-server/node_modules/.pnpm/electron@33.4.11/node_modules/electron/dist/resources/default_app.asar/main.js:242:9Environment
v25.1.033.4.110.2.010.20.025.1.8Checklist