最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - missing script: build - firebase deploy - Stack Overflow

programmeradmin4浏览0评论

When I deployed my firebase function project, this error appeared "missing script:build" and I try to fix it but it fails. Please help me

This is error screenshot

When I deployed my firebase function project, this error appeared "missing script:build" and I try to fix it but it fails. Please help me

This is error screenshot

Share Improve this question asked Aug 9, 2018 at 7:18 Hassan SalahHassan Salah 2173 silver badges8 bronze badges 2
  • If you package.json doesn't define a script action for build, that will happen. – Doug Stevenson Commented Aug 9, 2018 at 7:20
  • 2 Already not defined.How do I define a script action for build? @DougStevenson – Hassan Salah Commented Aug 9, 2018 at 7:22
Add a ment  | 

3 Answers 3

Reset to default 14

Remove the "predeploy" from firebase.json

{
  "functions": {
    "predeploy": "npm --prefix functions run build",
    "source": "functions"
  }
}

For me, it worked when I added this:

"build": "",
{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "build": "",
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "12"
  },
  "main": "index.js",
  "dependencies": {
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "firebase": "^7.22.0",
    "firebase-admin": "^9.4.1",
    "firebase-functions": "^3.11.0"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

I was also facing the same error. I modified the scripts section as follows. This resolved the issue and function got deployed.

"scripts": {
    "build": "",
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  }
发布评论

评论列表(0)

  1. 暂无评论