zhangyuang / node-ffi-rs

Implement ffi in Node.js by Rust and NAPI
MIT License
189 stars 7 forks source link

在win2019上运行出现错误 #36

Closed weziye closed 6 months ago

weziye commented 6 months ago

C:\Users\Administrator\Desktop\test\node_modules\ffi-rs\index.js:309 throw loadError ^

Error: The specified module could not be found. \?\C:\Users\Administrator\Desktop\test\node_modules\@yuuang\ffi-rs-win32-x64-msvc\ffi-rs.win32-x64-msvc.node at Module._extensions..node (node:internal/modules/cjs/loader:1464:18) at Module.load (node:internal/modules/cjs/loader:1205:32) at Module._load (node:internal/modules/cjs/loader:1021:12) at Module.require (node:internal/modules/cjs/loader:1230:19) at require (node:internal/modules/helpers:179:18)

zhangyuang commented 6 months ago

提供更加详细的信息,当前node.js 的process.arch和process.platform

weziye commented 6 months ago

Node Version: v21.7.1 Operating System Platform: win32 Processor Architecture: x64 OS Type: Windows_NT OS Version: Windows Server 2019 Standard OS Release: 10.0.17763 Total Memory: 63.99 GB Free Memory: 59.71 GB System Uptime: 674764.421 seconds Hostname: SYNERGY-E7SASIR Network Interfaces: { 'Ethernet 2': [ { address: 'fe80::450b:e544:d337:89df', netmask: 'ffff:ffff:ffff:ffff::', family: 'IPv6', mac: '68:b5:99:bd:cb:20', internal: false, cidr: 'fe80::450b:e544:d337:89df/64', scopeid: 9 }, { } ], 'Loopback Pseudo-Interface 1': [ { address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', family: 'IPv6', mac: '00:00:00:00:00:00', internal: true, cidr: '::1/128', scopeid: 0 }, { address: '127.0.0.1', netmask: '255.0.0.0', family: 'IPv4', mac: '00:00:00:00:00:00', internal: true, cidr: '127.0.0.1/8' } ] } CPU Information: [ { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 3383796, nice: 0, sys: 784687, idle: 670595953, irq: 31156 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 1466031, nice: 0, sys: 461796, idle: 672836046, irq: 4437 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 171062, nice: 0, sys: 87656, idle: 674505156, irq: 1671 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 78796, nice: 0, sys: 42406, idle: 674642671, irq: 656 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 67390, nice: 0, sys: 29781, idle: 674666703, irq: 328 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 38328, nice: 0, sys: 19421, idle: 674706125, irq: 171 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 32968, nice: 0, sys: 17250, idle: 674713656, irq: 234 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 20750, nice: 0, sys: 10609, idle: 674732515, irq: 31 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 20281, nice: 0, sys: 10437, idle: 674733140, irq: 203 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 14796, nice: 0, sys: 6843, idle: 674742218, irq: 125 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 14750, nice: 0, sys: 7734, idle: 674741375, irq: 1546 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 11140, nice: 0, sys: 12046, idle: 674740671, irq: 62 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 2692640, nice: 0, sys: 1941390, idle: 670129828, irq: 10765 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 1946593, nice: 0, sys: 1334125, idle: 671483140, irq: 6171 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 183609, nice: 0, sys: 77281, idle: 674502968, irq: 625 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 79718, nice: 0, sys: 34312, idle: 674649812, irq: 468 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 92000, nice: 0, sys: 29921, idle: 674641921, irq: 234 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 39406, nice: 0, sys: 16781, idle: 674707656, irq: 312 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 50937, nice: 0, sys: 22812, idle: 674690093, irq: 203 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 30812, nice: 0, sys: 13000, idle: 674720031, irq: 171 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 30406, nice: 0, sys: 13156, idle: 674720281, irq: 109 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 22640, nice: 0, sys: 11421, idle: 674729781, irq: 78 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 29421, nice: 0, sys: 12078, idle: 674722328, irq: 171 } }, { model: 'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz', speed: 2667, times: { user: 17375, nice: 0, sys: 10531, idle: 674735921, irq: 62 } } ]

zhangyuang commented 6 months ago

可以ls node_modules/@yuuang文件夹看看下面的依赖

weziye commented 6 months ago

WX20240515-161145@2x

zhangyuang commented 6 months ago

看起来是调用ffi-rs时候的错误,提供一下调用代码

weziye commented 6 months ago

相同的代码可以运行在win10上运行 Operating System Platform: win32 Processor Architecture: x64
OS Type: Windows_NT OS Version: Windows 10 Pro
OS Release: 10.0.18363 Total Memory: 4.00 GB Free Memory: 1.14 GB System Uptime: 126.437 seconds
Hostname: DESKTOP-DR9AMH4

image
zhangyuang commented 6 months ago

直接使用require('@yuuang/ffi-rs-win32-x64-msvc').open试试

weziye commented 6 months ago

不行的,在下面这个地方报错了,文件是存在的,就是无法加载

image
zhangyuang commented 6 months ago

直接 require('@yuuang/ffi-rs-win32-x64-msvc/ffi-rs.win32-x64-msvc.node') 就会报错吗

weziye commented 6 months ago

是的

zhangyuang commented 6 months ago

报什么错误再具体贴一下, 类似于这样的输出信息

image
zhangyuang commented 6 months ago

已解决,服务器环境缺少必要的c基础库,安装VS2017后解决