我试图在我的根项目中安装flutterfire_cli,所以我输入了以下命令:
FirebaseFirestore firestore = FirebaseFirestore.instance;
在此之后,这就是我的控制台的输出:
PS C:\Users\PC\Desktop\eventually> dart pub global activate flutterfire_cli
Package flutterfire_cli is currently active at version 0.1.1+2.
Resolving dependencies...
The package flutterfire_cli is already activated at newest available version.
To recompile executables, first run `global deactivate flutterfire_cli`.
Installed executable flutterfire.
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated flutterfire_cli 0.1.1+2.
为了修复警告,我在系统变量环境中将C:\Users\PC\AppData\Local\Pub\Cache\bin添加到我的路径中。(但这不起作用,我还在收到警告)
接下来,我尝试使用以下命令生成firebase_options.dart文件,如文档所述:
flutterfire configure
但是我在控制台上发现了一个错误:
PS C:\Users\PC\Desktop\eventually> flutterfire configure
flutterfire : The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ flutterfire configure
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (flutterfire:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
有人能告诉我我遗漏了什么吗,为什么我会得到这个错误,即使Firebase CLI已经安装在我的机器上了?
发布于 2021-12-12 16:09:31
仔细阅读这个文档:https://firebase.flutter.dev/docs/cli/
步骤1:安装火基CLI
步骤2:使用以下命令安装FlutterFire CLI
在执行此操作时,您必须注意以下警告
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path. You can fix that by adding that directory to your system's "Path" environment variable. A web search for "configure windows path" will show you how.
这意味着您需要将C:\Users\*username*\AppData\Local\Pub\Cache\bin
添加到系统的环境路径中。
第三步:现在flutterfire configure
应该能工作。
如果仍然不能使用[消]消防命令
发布于 2022-06-06 16:16:06
对于Mac ->,请执行以下命令:
export PATH="$PATH":"$HOME/.pub-cache/bin"
发布于 2022-01-03 01:23:21
至于我,我已经正确地完成了所有事情,如果我在Windows命令提示符中运行,这个命令就能工作,但是如果我在VS代码终端中输入命令,它就不能工作。
所以我杀了终端机,然后再打开它,然后它就开始工作了。
或者,你可以试着重新启动你的机器。
https://stackoverflow.com/questions/70320263
复制相似问题