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
Asked
Active
Viewed 5,123 times
3
-
If you package.json doesn't define a script action for `build`, that will happen. – Doug Stevenson Aug 09 '18 at 07:20
-
2Already not defined.How do I define a script action for build? @DougStevenson – Hassan Salah Aug 09 '18 at 07:22
3 Answers
13
Remove the "predeploy" from firebase.json
{
"functions": {
"predeploy": "npm --prefix functions run build",
"source": "functions"
}
}

Evorlor
- 7,263
- 17
- 70
- 141

user3338763
- 151
- 4
2
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
}

F. Müller
- 3,969
- 8
- 38
- 49

Rensi Arteaga Copari
- 76
- 6
0
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"
}

Nikhil
- 861
- 11
- 15