1

I tried to run firebase deploy --only functions in my ionic project and this error message show up

C:\Program Files\Git\usr\local>firebase deploy --only functions
=== Deploying to 'testing-ed384'...

i  deploying functions
Running command: npm --prefix "%RESOURCE_DIR%" run lint
npm ERR! missing script: lint

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\CJ\AppData\Roaming\npm-cache\_logs\2019-12-13T14_26_34_575Z-debug.log
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm --prefix "C:\Program Files\Git\usr\local\functions" run lint ENOENT
    at notFoundError (C:\Program Files\Git\usr\local\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Program Files\Git\usr\local\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Program Files\Git\usr\local\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Program Files\Git\usr\local\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm --prefix "C:\\Program Files\\Git\\usr\\local\\functions" run lint',
  path: 'npm --prefix "C:\\Program Files\\Git\\usr\\local\\functions" run lint',
  spawnargs: []
}

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

How can I solve this problem?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
10IEI
  • 21
  • 1
  • 5

2 Answers2

0

This may happen because:

  • You don't have eslint installed. This could happen if at the time you ran firebase init functions you answered no when prompted Do you want to use ESLint to catch probable bugs and enforce style? and/or you answered no when prompted to install dependencies. If that's the case reinitialize the environment to get it installed.
  • You're missing the eslint package in your package.js file. To check/fix this open it up and look if you have something in the lines of:
"devDependencies": {
    "eslint": "^4.12.0",
    "eslint-plugin-promise": "^3.6.0"
  },
Happy-Monad
  • 1,962
  • 1
  • 6
  • 13
0

I fixed this by re-initiating firebase init. Then not selecting to use eslint. After that firebase deploy run normally.

Dharman
  • 30,962
  • 25
  • 85
  • 135