Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows10下部分机型报错问题 #25

Open
ByLiangCheng opened this issue Mar 29, 2023 · 9 comments
Open

Windows10下部分机型报错问题 #25

ByLiangCheng opened this issue Mar 29, 2023 · 9 comments

Comments

@ByLiangCheng
Copy link

ef1a7e01a1e262c186451359449bbc0

Windows10的版本为专业版

如图所示,只要应用窗口页面引入了包:import { Screenshots } from 'node-screenshots'

在启动的时候,部分windows10系统就会提示图中的这个错误,导致应用无法启动

目前部分电脑的解决方案是重新更新了电脑dll库解决的,还有部分目前无法解决

这个有更好的解决方案吗?

@nashaofu
Copy link
Owner

  1. 你在有问题的机器上,安装node-screenshots,然后执行下面的js代码,看看是否会报错
const { Screenshots } = require('node-screenshots')
  1. 找到 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

@ByLiangCheng
Copy link
Author

尝试运行代码没有报错
const { Screenshots } = require('node-screenshots')

node_modules包含对应的模块

使用上述链接中的方式好像也没有效果

@nashaofu
Copy link
Owner

nashaofu commented Apr 4, 2023

这个问题看起来是你打包后node_modules下面没有node-screenshots.win32-x64-msvc.node这个文件,你排查一下吧,并不是电脑dll文件问题,因为你直接运行const { Screenshots } = require('node-screenshots')是可以的

@ByLiangCheng
Copy link
Author

好的,我再排查一下,谢谢回复

@Azperin
Copy link

Azperin commented May 19, 2023

Maybe will help.

  1. Download or clone git repository
  2. Navigate CMD to that folder (google command cd)
  3. Run command npm install
  4. Run command npm run build
  5. 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();

@likunru
Copy link

likunru commented Jun 21, 2023

window10下我也遇到相同问题,有人知道如何解决吗。感谢

@ByLiangCheng
Copy link
Author

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

@nashaofu
Copy link
Owner

这里是我打包出来的一个可执行文件screenshots.zip,下载解压后,在命令行执行./screenshots.exe看看是否能正常执行,以帮助我确定是screenshots-rs这个库有问题还是napi-rs的问题。
image

@Yik-L
Copy link

Yik-L commented Jul 9, 2024

在app中接一下这个依赖就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants