项目局部结构
相关代码(cExtensionTest/index.js)
console.log('111')
const ffi = require('ffi-napi')
console.log('222')
const DLLtest = new ffi.Library('./DLLtest.dll', {
'hello': ['void', []],
})
DLLtest.hello()
exports.main = async (event, context) => {
console.log('event : ', event)
// DLLtest.hello()
return event
};
问题描述
这里希望使用一个npm的模块"ffi-napi",已经通过npm install
安装于云函数目录中
右键-该云函数文件夹-本地运行云函数 多次失败,发现是 const ffi = require('ffi-napi')
引起的
但是在HBuilder里的终端直接 node index.js
运行该函数则成功
若上传该云函数并调用则会返回错误502
期待的结果
能够正确在云函数中引入/使用该npm模块