我正在尝试运行对TensorflowJS有依赖关系的Azure函数,导致ELF标头无效。我知道这通常表示依赖关系是为其他架构构建的。在这种情况下,这是有意义的,因为我正在本地运行OSX并部署到Linux。
通过VSCode部署工作正常,只有当我从Postman调用函数时,错误才会出现。我如何在Azure上运行依赖项安装,而不是在本地构建并上传zip?这就是VSCode通过Azure插件所做的事情。
函数依赖项:
"dependencies": {
"@anzp/azure-function-multipart": "^3.1.0",
"@tensorflow/tfjs-node": "^4.2.0"
},
"devDependencies": {
"@azure/functions": "^3.0.0",
"@types/node": "16.x",
"azure-functions-core-tools": "^4.x",
"typescript": "^4.0.0"
}
输出错误:
Result: Failure Exception: Worker was unable to load function predict: '/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node: invalid ELF header' Stack: Error: Worker was unable to load function predict: '/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node: invalid ELF header' at Object.Module._extensions..node (node:internal/modules/cjs/loader:1239:18) at Module.load (node:internal/modules/cjs/loader:1033:32) at Function.Module._load (node:internal/modules/cjs/loader:868:12) at Module.require (node:internal/modules/cjs/loader:1057:19) at Object.apply (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:42034) at require (node:internal/modules/cjs/helpers:103:18) at Object.<anonymous> (/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/dist/index.js:72:16) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) at Module.load (node:internal/modules/cjs/loader:1033:32)
1条答案
按热度按时间mf98qq941#
我通过使用GitHub工作流来部署函数,而不是通过VS代码来完成,这样我就可以为Linux构建,错误也消失了。