Fix Firebase INVALID_ARGUMENT error when trying to deploy functions that uses Node 8 as engine

Due to a bug that affects yarn (possibly npm too) package management during build time when including the dependencies lock file, the deployment fails with following error:

✔  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...  
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...  
i  functions: packaged functions (44.53 KB) for uploading  
✔  functions: functions folder uploaded successfully                      
i  functions: updating Node.js 8 function updateAttendeesCount(us-central1)...  
⚠  functions[updateAttendeesCount(us-central1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`yarn_install` had stderr output:\nerror [email protected]: The engine \"node\" is incompatible with this module  
. Expected version 8.\nerror Found incompatible module\n\nerror: `yarn_install` returned code: 1", "errorType": "InternalError", "errorId": "C378A09F"}}


Functions deploy had errors with the following functions:  
        updateAttendeesCount


To try redeploying those functions, run:  
    firebase deploy --only functions:updateAttendeesCount


To continue deploying other features (such as database), run:  
    firebase deploy --except functions                                        

Error: Functions did not deploy properly.  

To workaround this, simply delete yarn.lock and/or package-lock.json files before doing firebase deploy

rm functions/yarn.lock functions/package-lock.json  
firebase deploy --only functions