Ошибка развертывания gRP C с узлом в облачной функции Google - PullRequest
0 голосов
/ 11 апреля 2020

Я пытаюсь развернуть Google Assisant SDK в Node.js в облачной функции Google, но сталкиваюсь с этой ошибкой ..

Deployment failure:
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v57-linux-x64-glibc
Found: [node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/srv/google-assistant-grpc/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node'
at Object.<anonymous> (/srv/google-assistant-grpc/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
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/google-assistant-grpc/node_modules/grpc/src/client_interceptors.js:144:12)
at Module._compile (module.js:653:30

При поиске в Интернете мне кажется, что мне нужно восстановить с конкретный c двоичный файл. Так что в моем package.json я добавил это, но это, похоже, ничего не сделало. Для развертывания я просто архивирую все и загружаю в интерфейс Google Cloud Function. Есть идеи?

    "scripts": {
      "postinstall": "npm rebuild --target=8.1.0 --target_platform=linux --target_arch=x64 --target_libc=glibc --update-binary"
    }

...