5

iam trying to deploy my first cloud function on firebase but the problem is that it always says that there is something wrong and no files are matching the pattern i dont know why even that the index.ts is where it is supposed to be the error code is

=== Deploying to 'mscmu-aeab1'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:\Users\fahmi\msc_mu\cloud_functions\functions
> eslint 'src/**/*'


Oops! Something went wrong! :(

ESLint: 7.9.0

No files matching the pattern "'src/**/*'" were found.
Please check for typing mistakes in the pattern.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ lint: `eslint 'src/**/*'`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\fahmi\AppData\Roaming\npm-cache\_logs\2020-09-26T22_01_33_578Z-debug.log

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


https://i.stack.imgur.com/ehdoE.png

Fahmi Sawalha
  • 682
  • 6
  • 19
  • Please edit the question to explain the full set of steps you took to get to this point. It should contain enough detail that anyone can reliably reproduce the issue. The error message suggests that you have no source code under "src" to deploy. – Doug Stevenson Sep 26 '20 at 22:16
  • but i do have that as i said , i have a the index.ts file and the cloud function in it – Fahmi Sawalha Sep 26 '20 at 22:22
  • This looks like it was due to the fact that you're using Windows, and the new functions template for the CLI does not support it. – Doug Stevenson Sep 26 '20 at 23:00

3 Answers3

13

In your functions package.json edit the lint script as follows:

eslint --ext .ts src
Francesco Colamonici
  • 1,147
  • 1
  • 10
  • 16
  • Changing the blob into just `src` is also important, but why? – Qwerty Oct 11 '20 at 17:01
  • `eslint` supports both syntaxes, actually. If you prefer to use the glob pattern, you need to escape `\"`s to make it work both on Linux and Windows. - https://eslint.org/docs/user-guide/command-line-interface – Francesco Colamonici Oct 12 '20 at 07:10
3

This problem is solved in this commit.

In your functions folders open package.json and edit the line starting with lint like this:

"lint": "eslint \"src/**/*\""
Sky
  • 4,244
  • 7
  • 54
  • 83
-1

This issue is resolved with the Firebase CLI version 8.12.0. The update is to escape quotes around the argument to eslint as shown in this commit.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441