Lal Pratheesh S S
Lal Pratheesh S S

Reputation: 116

Firebase CLI deploy Error: There was an error reading functions/package.json

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

Upvotes: 8

Views: 2864

Answers (2)

Chen Peleg
Chen Peleg

Reputation: 2124

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.

Upvotes: 2

Tanaka Craig Kaseke
Tanaka Craig Kaseke

Reputation: 79

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

Upvotes: 7

Related Questions