Windows10下部分机型报错问题
ByLiangCheng opened this issue · comments
- 你在有问题的机器上,安装
node-screenshots
,然后执行下面的js代码,看看是否会报错
const { Screenshots } = require('node-screenshots')
- 找到 electron 打包后的
resources
文件夹,看看里面的node_modules是否包含对应的模块,如果没有也可以解压asar
这个文件,看看里面的node_modules是否包含对应模块。可参考这个排查一下https://github.com/nashaofu/screenshots/blob/master/packages/electron-screenshots/README.md#%E6%B3%A8%E6%84%8F
尝试运行代码没有报错
const { Screenshots } = require('node-screenshots')
node_modules包含对应的模块
使用上述链接中的方式好像也没有效果
这个问题看起来是你打包后node_modules下面没有node-screenshots.win32-x64-msvc.node
这个文件,你排查一下吧,并不是电脑dll文件问题,因为你直接运行const { Screenshots } = require('node-screenshots')
是可以的
好的,我再排查一下,谢谢回复
Maybe will help.
- Download or clone git repository
- Navigate CMD to that folder (google command
cd
) - Run command
npm install
- Run command
npm run build
- In project root folder you gonna have
.node
file, require it in any of your projects.
My usage is like this, cuz I only need fullscreen shots:
const PRIMARY_DISPLAY = require('./node-screenshots.win32-x64-msvc.node').Screenshots.fromPoint(0, 0);
/* some logic */
const shot = PRIMARY_DISPLAY.captureSync();
window10下我也遇到相同问题,有人知道如何解决吗。感谢
window10下我也遇到相同问题,有人知道如何解决吗。感谢
我是Electron开发环境,但是上一次在提交这个issues时不知道是否因为测试有误还是环境问题,没有复现出来
后面我的应用发版后,持续有部分用户反馈这个问题,让他们尝试更新dll库后就可以正确运行了,所以暂时确认是用户电脑缺少dll导致
后面也看到eSearch项目引入了此库, 并在issues看到也存在这个问题 eSearch 的 issues #123
看他的解决方案就是安装VC_redist.x64.exe,
参考他的部分代码后,我现在的解决方案:
打包应用时一起把VC_redist.x64.exe一起打包进去,并在builder-installer.nsh内配置了,当安装应用时触发调起VC_redist.x64.exe安装,这样可以保证用户在使用时dll库是完整的
具体builder-installer.nsh实现可以参考: TTime builder-installer.nsh
这里是我打包出来的一个可执行文件screenshots.zip,下载解压后,在命令行执行./screenshots.exe
看看是否能正常执行,以帮助我确定是screenshots-rs
这个库有问题还是napi-rs
的问题。