gpt4 book ai didi

FlutterFire 配置 CLI 需要官方的 Firebase CLI

转载 作者:行者123 更新时间:2023-12-05 03:23:37 25 4
gpt4 key购买 nike

我在为我的项目配置 Flutter Fire 时遇到问题。我使用 npm install -g firebase-tools --force 安装,然后尝试 > dart pub global activate flutterfire_cli 但我仍然遇到 CLI 问题。我可以登录并查看版本,但无法运行 flutterfire 配置

FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.


在阅读了 stackoverflow 和互联网上的所有主题后,我无法解决我的问题,有什么想法吗?运行 npm install -g firebase-tools 我得到了这个:

>  npm install -g firebase-tools
C:\Users\loveh\.cache\firebase\tools\firebase -> C:\Users\loveh\.cache\firebase\tools\node_modules\firebase-tools\lib\bin\firebase.js
+ firebase-tools@11.0.1
updated 1 package in 11.091s

现在出现这个错误:

⠋ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
#
^

#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:7)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:264:24)
<asynchronous suspension>
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:351:37)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 main (file:///C:/Users/loveh/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.2+2/bin/flutterfire.dart:57:5)
<asynchronous suspension>

新闻

 npm install -g firebase-tools
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/d
ebug/issues/797)
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

changed 691 packages, and audited 692 packages in 36s

38 packages are looking for funding
run `npm fund` for details

25 vulnerabilities (15 moderate, 10 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run `npm audit` for details.

最佳答案

如果您收到 FormatException: Unexpected character (at character 1) 错误,请查看您的 flutter 主文件夹中是否有 firebase.exe 文件。这是我的问题。删除文件后,flutterfire configure 正常运行。

澄清:我已将 firebase-cli 二进制文件 (firebase-tools-instant-win.exe) 添加到我的 flutter 项目的主文件夹中,并将其重命名为 firebase.exe 因为之前的错误修复尝试。如果您没有这样做,您的 flutter 主文件夹中应该没有 firebase 二进制文件。

关于FlutterFire 配置 CLI 需要官方的 Firebase CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72482277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com