单独运行nodejs调用user32.dll
在命令行工具窗口有焦点时,可以让目标程序获得焦点,反之不行
用electron 打包exe, 报错
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
或
Error: A dynamic link library (DLL) initialization routine failed.
网上方案一:删了重装
方案二:重编译
-
npm i electron-rebuild -s
-
./node_modules/.bin/electron-rebuild 或
64位编译:
node-gyp rebuild –target=3.0.0 –arch=x64 –target_arch=x64 –dist-url=https://npm.taobao.org/mirrors/atom-shell
或一键编译:
electron-builder install-app-deps
一样报错,少了xxx.node文件,大多解决方案无 –abi参数,
Electron打包Node程序:怎么获取electron、node的abi以及指导abi获取版本(2) – 莫道 – 博客园
获取到对应的abi后(
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing 也提示了iba版本
)
加入abi参数
(
electron node 版本不匹配的解决细节_真·skysys的博客-CSDN博客_electron node版本
)
npm rebuild –runtime=electron –target=3.0.0 –disturl=https://atom.io/download/atom-shell –abi=64
打包
electron-packager . HelloWorld –platform=win32 –arch=x64 –out=./out –asar –app-version=0.0.1 –electron-version 3.0.0
运行后还是一样,无焦点时,功能无法实现……………………..