我对此很陌生,所以这是我的问题。我有一个c ++代码,并使用node-addon api在node js文件中使用它。现在,我想将此节点js文件发送到Firebase云函数中。我遵循了分步教程,当我尝试部署节点功能时,这是我得到的错误:
i deploying functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (9.55 MB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating Node.js 8 function mapprResponse(us-central1)...
! functions[mapprResponse(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error: /srv/build/Release/addons.node: invalid ELF header
at Object.Module._extensions..node (module.js:682:18)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/srv/index.js:1:78)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
我没有任何语法错误,当我尝试通过节点对其进行检查时,它可以工作并提供了我想要的实际输出。我也使用节点版本8,因为版本10无法与我的功能一起使用,我不知道为什么。如果需要更多信息,请让我知道,我将提前上传。