0

I've been trying to deploy my firebase functions project for some time now and I can't seem to do it. I've followed some other question suggestions but none have worked. I've tried adding escaped colons to the predeploy:

"predeploy": [
      "npm --prefix \"$RESOURCE_DIR\""
]

And I've also tried renaming my spaced folder into a single word folder and it hasn't worked either. This is the error:

Error: functions predeploy error: Command terminated with non-zero exit code1

This is my package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "firebase-admin": "^5.8.2",
    "firebase-functions": "^1.0.1"
  },
  "private": true
}

And this is my firebase.json:

{
  "database": {
    "rules": "database.rules.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\""
    ]
  },
  "storage": {
    "rules": "storage.rules"
  }
}

Note: I removed the run lint myself from the predeploy.

I can't even seem to deploy the helloWorld example function. When trying to serve the project I'm getting this warning:

Warning: You're using Node.js v9.4.0 but Google Cloud Functions only supports v6.11.5

However, the project is actually served correctly. I've also tried uninstalling the google-cloud globally and installing it again, and the warning didn't go away.

Please help me, I've run out of ideas. Thank you in advance.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Tom Piaggio
  • 650
  • 8
  • 27

1 Answers1

0

You either remove the npm --prefix or add at least one

{
  "functions": {
    "predeploy": [],
    "source": "functions"
  }
}

Or you try it with this:

{
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ],
    "source": "functions"
  }
}
EluciusFTW
  • 2,565
  • 6
  • 42
  • 59
Suneel
  • 1
  • 1