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
Share Improve this question asked Aug 9, 2018 at 7:18 Hassan SalahHassan Salah 2173 silver badges8 bronze badges 2This is error screenshot
-
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
3 Answers
Reset to default 14Remove 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"
}