Error when trying to execute "firebase deploy" in React App

Viewed 370

When trying to deploy my React application, after having done "npm run build" and after configure the hosting in "firebase.json" file, the whole firebase process runs correctly until I get the message "Error: An unexpected error has occurred." checking the file "firebase-debug.log" I find this problem:

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at release (C:\Users\Jhonny\AppData\Roaming\nvm\v16.0.0\node_modules\firebase-tools\lib\deploy\functions\release.js:47:10)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[error] 
[error] Error: An unexpected error has occurred.

This problem is solved by directly modifying the Node file but then another similar message appears, and so on, also I don't think it is the correct solution.

Node version: 14.17 LTS

Thanks in advance

2 Answers

One possibility is that you forget to export the function like:

export const func = functions. // ...

Simply, upgrade node by running the following command in your terminal:

npm install node
Related