首页 > 解决方案 > Firebase Deploy Cloud Functions - 60 个错误同时出现

问题描述

我有一段时间没有对我的 Firebase Cloud Functions 进行任何更新。我只是对字符串进行了简单的更改,所以我知道它不会是 index.ts 文件中的代码问题。当我尝试部署时,Firebase 要求我更新节点和其他组件,我这样做了,然后我尝试运行部署命令。

我遇到了 60 个看起来像这样的错误(我只包括前几个,因为它们都遵循类似的格式):

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:2:13 - error TS1005: '=' expected.

2 import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
              ~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:2:119 - error TS1005: ';' expected.

2 import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:3:13 - error TS1005: '=' expected.

3 import type { ChannelTraceEvent as _grpc_channelz_v1_ChannelTraceEvent, ChannelTraceEvent__Output as _grpc_channelz_v1_ChannelTraceEvent__Output } from '../../../grpc/channelz/v1/ChannelTraceEvent';
              ~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:3:153 - error TS1005: ';' expected.

3 import type { ChannelTraceEvent as _grpc_channelz_v1_ChannelTraceEvent, ChannelTraceEvent__Output as _grpc_channelz_v1_ChannelTraceEvent__Output } from '../../../grpc/channelz/v1/ChannelTraceEvent';
                                                                                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:4:13 - error TS1005: '=' expected.

4 import type { Long } from '@grpc/proto-loader';
              ~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts:4:27 - error TS1005: ';' expected.

4 import type { Long } from '@grpc/proto-loader';
                            ~~~~~~~~~~~~~~~~~~~~

node_modules/@grpc/grpc-js/build/src/generated/grpc/channelz/v1/Channelz.d.ts:1:13 - error TS1005: '=' expected.

1 import type * as grpc from '../../../../index';
              ~

Found 60 errors.
Error: functions predeploy error: Command terminated with non-zero exit code2

知道如何解决这个问题吗?

标签: firebasegoogle-cloud-functions

解决方案


当我尝试运行 firebase serve 时,我遇到了同样的问题,函数和公共文件夹中出现 60 个错误,原因是缺少依赖项(依赖项没有以某种方式安装)。

我跑了yarn,它给了我警告,这也解释了缺少什么以及在哪里。

% yarn
yarn install v1.22.17
[1/5]   Resolving packages...
[2/5]   Fetching packages...
[3/5]   Linking dependencies...
warning "workspace-aggregator-... > PATH/common > react-mapbox-gl@4.6.0" has unmet 
peer dependency "prop-types@^15.6.2".

这是警告之一。在yarn add prop-types公共文件夹中之后,它就消失了。我手动更新了每个警告,这为我解决了问题。我必须更新的一件事是打字稿,它解决了 48/60 错误,但我不得不几乎一一解决其余的问题。


推荐阅读