I am following the Cloud Functions tutorial in order to learn how to use Firebase Functions. It all went nice and dandy until the stage I needed to deploy to the cloud - for some reason, I got a syntax exception! It seems the exception is caused by a lambda function:
$ firebase deploy --only functions
=== Deploying to 'my-project-87547'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint E:\Users\Emmet\Documents\firebase_tutorial\functions
> eslint .
E:\Users\Emmet\Documents\firebase_tutorial\functions\index.js
10:65 error Parsing error: Unexpected token =>
✖ 1 problem (1 error, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
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\Emmet\AppData\Roaming\npm-cache\_logs\2021-03-31T16_31_27_784Z-debug.log
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
at notFoundError (C:\Users\Emmet\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\Emmet\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\Emmet\AppData\Roaming\npm\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:277:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\Emmet\AppData\Roaming\npm\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:277:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
path: 'npm --prefix "%RESOURCE_DIR%" run lint',
spawnargs: []
}
Error: functions predeploy error: Command terminated with non-zero exit code1
What's really weird is that I am using verbatim the index.js provided in the tutorial itself, and also it passed successfully and as expected in the Firebase Local Emulator Suite.
For reference, I am running all my commands from a Git Bash terminal (with Administrator) from a Windows 10 PC. My npm version is 6.14.11 and my NodeJS version is v14.16.0.
I know others have experienced similar issues, but I haven't seen anyone get it with the tutorial script itself. Thanks in advance!