Firebase Cloud Function部署失败:依赖安装报错求助
Firebase Cloud Functions部署Editly依赖安装错误解决求助
我正在开发Node.js版Firebase Cloud Function,功能为从Google Cloud Storage下载图片,通过Editly库合成为短视频,但部署时出现依赖安装错误,具体报错信息如下:
Build failed with status: FAILURE and message: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin. npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs npm ERR! code 1 npm ERR! path /workspace/node_modules/gl npm ERR! command failed npm ERR! command sh -c prebuild-install || node-gyp rebuild npm ERR! prebuild-install warn install No prebuilt binaries found (target=18.16.0 runtime=node arch=x64 libc= platform=linux) npm ERR! /bin/sh: 1: python: not found npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/workspace/node_modules/node-gyp/lib/configure.js:325:16) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Linux 5.10.0-22-cloud-amd64 npm ERR! gyp ERR! command "/layers/google.nodejs.runtime/node/bin/node" "/workspace/node_modules/.bin/node-gyp" "rebuild" npm ERR! gyp ERR! cwd /workspace/node_modules/gl npm ERR! gyp ERR! node -v v18.16.0 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! /www-data-home/.npm/_logs/2023-06-12T18_15_16_459Z-debug-0.log. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=us-central1/9901c171-df82-40f3-9038-9f5c35417bc9?project=694499372205. Functions deploy had errors with the following functions: videocreation:createVideo(us-central1)
函数代码(index.js)
const { initializeApp } = require("firebase-admin/app"); const { getStorage } = require("firebase-admin/storage"); const path = require("path"); const { onRequest } = require("firebase-functions/v2/https"); initializeApp(); exports.createVideo = onRequest(async (req, res) => { const imagesBucket = await getStorage().bucket().getFiles(); const images = await Promise.all( imagesBucket[0].map(async (image) => { await image.download({ destination: path.join(__dirname, image.id) }); return path.join(__dirname, image.id); }) ); const Editly = await import("editly"); await Editly({ outPath: path.join(__dirname, "out.mp4"), audioFilePath: path.join( __dirname, "Sheck%20Wes%20-%20Mo%20Bamba%20(Lyrics).mp3" ), fps: 30, width: 1080, loopAudio: true, clips: images .filter((pathToImage) => !pathToImage.includes(".mp3")) .map((imagePath) => { return { duration: 3, layers: [ { type: "image", path: imagePath, }, ], }; }), }); });
package.json内容
{ "name": "functions", "scripts": { "lint": "eslint --ext .js,.ts .", "lintfix": "eslint --fix --ext .js,.ts .", "build": "tsc", "build:watch": "tsc --watch", "serve": "npm run build && firebase emulators:start --only functions", "shell": "npm run build && firebase functions:shell", "start": "npm run shell", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log" }, "engines": { "node": "18" }, "main": "src/index.js", "dependencies": { "editly": "^0.14.2", "firebase-admin": "^11.5.0", "firebase-functions": "^4.4.0" }, "devDependencies": { "@types/fabric": "^5.3.3", "@typescript-eslint/eslint-plugin": "^5.12.0", "@typescript-eslint/parser": "^5.12.0", "eslint-config-google": "^0.14.0", "eslint-plugin-import": "^2.25.4", "firebase-functions-test": "^3.0.0", "typescript": "^4.9.0" }, "private": true }
恳请各位提供帮助!
内容的提问来源于stack exchange,提问作者Kaleb Schmottlach
相关产品推荐
相关产品推荐

