Error deploying with firebase on npm --prefix $RESOURCE_DIR run lint

Try to replace $RESOURCE_DIR with %RESOURCE_DIR% in your firebase.json file.

Multi platform solution

As seen on this post let's summarize the configuration for the different platforms you are running on:

Linux

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

PowerShell

"predeploy": [
"npm --prefix $Env:RESOURCE_DIR run lint"
]

Cmd.exe

"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]

SUMMARIZING

  1. Install ESLint locally to add "devDependencies" to package.json. Run:

     `npm install eslint --save-dev`
    
  2. Workaround for Windows as stated above. Change firebase.json:

     `npm --prefix $RESOURCE_DIR run lint` to `npm --prefix %RESOURCE_DIR% run lint`
    
  3. Optionally, add the following to package.json:

     "scripts": { "lint": "eslint"} or "scripts": { "lint": "eslint.js"}
    

you can simply make your firebase.json file like this:

{
  "functions": {
    "predeploy": [
      "npm --prefix ./functions/ run lint",
      "npm --prefix ./functions/ run build"
    ]
  }
}

what I'm doing is replace $RESOURCE_DIR with hard coded path of function folder itis working nice for me


It wants to lint your cloud functions, meaning it will check your code for obvious errors like a compiled language would throw errors at compile time.

It's not necessary, you can always remove it by going into firebase.json and updating functions.predeploy to be an empty array.

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

What is "Linting"?