• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

node + electron + robotjs 版本不兼容报错问题解决

武飞扬头像
qq_38239133
帮助1

一、

或者安装完成后   打开 全局electron --abi 或 局部 npx electron --abi  

二、

步骤一使 electron node版本对上之后,加上robotjs :

1.(1)可能问题一:安装robotjs,发现各种报错,

  1.  
    App threw an error during load
  2.  
    Error: A dynamic link library (DLL) initialization routine failed.
  3.  
    \\?\D:\vue\lianji\node_modules\robotjs\build\Release\robotjs.node
  4.  
        at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
  5.  
        at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18)
  6.  
        at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
  7.  
        at Module.load (internal/modules/cjs/loader.js:620:32)
  8.  
        at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
  9.  
        at Function.Module._load (internal/modules/cjs/loader.js:551:3)
  10.  
        at Module.require (internal/modules/cjs/loader.js:658:17)
  11.  
        at require (internal/modules/cjs/helpers.js:20:18)
  12.  
        at Object.<anonymous> (D:\vue\lianji\node_modules\robotjs\index.js:1:170)
  13.  
        at Object.<anonymous> (D:\vue\lianji\node_modules\robotjs\index.js:38:3)

(2)可能问题二:或复制以前的文件夹,报找不到模块的错误,abi 版本对不上, 按有些人说的再次装环境和node-gyp rebuild 编译等还是报错

2.解决方法:(以我电脑为例,按之前方法知道对应abi为64,在package.json加入 scripts)

  1.  
    "scripts": {
  2.  
    "start": "electron .",
  3.  
    "package": "electron-packager . HelloWorld --platform=win32 --out ./out --electron-version=3.0.0 --overwrite --abi=64 --arch=x64",
  4.  
    "rebuild": "npm rebuild --runtime=electron --target=3.0.0 --disturl=https://atom.io/download/atom-shell --abi=64"
  5.  
    },

运行 npm run rebuild 或 直接 

npm rebuild --runtime=electron --target=3.0.0 --disturl=https://atom.io/download/atom-shell --abi=64    

--target=3.0.0  为electron 版本, --abi为对应查询的的ABI版本

再运行 npm run start 发现已正常运行

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhggaeba
系列文章
更多 icon
同类精品
更多 icon
继续加载