尝试在 React App 中执行 "firebase deploy" 时出错
Error when trying to execute "firebase deploy" in React App
在尝试部署我的 React 应用程序时,完成“npm 运行 build”并在“firebase.json”文件中配置托管后,整个 firebase 进程 运行s直到我收到消息“错误:发生意外错误”。检查文件“firebase-debug.log”我发现了这个问题:
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.
直接修改Node文件解决了这个问题,但是又出现了类似的提示等等,我也觉得不是正确的解决方法。
节点版本:14.17 LTS
提前致谢
一种可能是您忘记导出函数,例如:
export const func = functions. // ...
只需在终端中通过运行以下命令升级节点:
npm install node
在尝试部署我的 React 应用程序时,完成“npm 运行 build”并在“firebase.json”文件中配置托管后,整个 firebase 进程 运行s直到我收到消息“错误:发生意外错误”。检查文件“firebase-debug.log”我发现了这个问题:
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.
直接修改Node文件解决了这个问题,但是又出现了类似的提示等等,我也觉得不是正确的解决方法。
节点版本:14.17 LTS
提前致谢
一种可能是您忘记导出函数,例如:
export const func = functions. // ...
只需在终端中通过运行以下命令升级节点:
npm install node