5

I recently getting this error when try to deploy the firebase cloud functions using the command firebase deploy --only functions. My package.json file is shown below

{
  "name": "functions",
  "scripts": {
    "lint": "tslint --project tsconfig.json",
    "build": "tsc",
    "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": "10"
  },
  "main": "lib/index.js",
  "dependencies": {
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "firebase-admin": "^8.12.1",
    "firebase-functions": "^3.6.2",
    "stripe": "^8.50.0"
  },
  "devDependencies": {
    "@types/cors": "^2.8.6",
    "dotenv": "^8.2.0",
    "firebase-functions-test": "^0.2.0",
    "tslint": "^5.12.0",
    "typescript": "^3.8.0"
  },
  "private": true
}

Using npm package firebase-tools of version 8.4.1.

Also getting error in firebase emulatorserror in terminal while serve it locally

  • There is a [question](https://stackoverflow.com/questions/59694126/firebase-cloud-functions-typescript-does-not-compile-to-javascript) with the similar case with yours. Could you take a look and let me know if that helps? – tzovourn Jun 10 '20 at 11:31

2 Answers2

3
  1. Enter into functions directory
  2. enter the following command npm run build
  3. and then deploy / launch your emulators
2

To me what happened was that I added a test folder out side of src folder. Because I use typescript the typesctipt compiler lost it and changed the output directory.

So if that's the case, move the other folders inside src.

Chen Peleg
  • 953
  • 10
  • 16