我在运行应用程序时尝试在电子(v5.0.5)应用程序中使用robots,出现以下错误,我使用了电子重建命令:
./node_modules/.bin/electron-rebuild
,也使用了npm rebuild
,但我仍然遇到同样的问题。
我还安装了nvm并尝试使用节点版本12.0.0、12.0.4、8.16。
我该如何解决此问题?
App threw an error during load
Error: The module '/app/node_modules/robotjs/build/Release/robotjs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:850:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at Module.require (internal/modules/cjs/loader.js:715:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/app/node_modules/robotjs/index.js:1:15)
at Module._compile (internal/modules/cjs/loader.js:808:30)