zhangyuang / node-ffi-rs

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

同样都是相对路径但是却显示找不到指定的模块 #57

Closed iceyxx6 closed 4 months ago

iceyxx6 commented 4 months ago

项目:

demo下的index,js:

const path = require('path') const { load, DataType, open, close } = require('ffi-rs') const dynamicLib = './ocr/OCR_Module.dll' open({ library: 'ocr', path: dynamicLib }) load({ library: 'ocr', funcName: 'start', retType: DataType.Void, paramsType: [], paramsValue: [] }) close('ocr')

node index.js 调用显示找不到指定的模块

但是在ocr文件夹下调用node index.js,就正常了,没有报错

ocr文件夹下的index.js唯一的区别就在于这里 const dynamicLib = './OCR_Module.dll' ,路径的引入

所以为什么都是相对路径却显示找不到路径,试了绝对路径也不行

zhangyuang commented 4 months ago

参考https://github.com/zhangyuang/node-ffi-rs/issues/43

iceyxx6 commented 4 months ago

已解决 将dll所在目录添加至环境变量即可