flutterfire命令未识别报错,配置系统环境变量后解决
解决
flutterfire : The term 'flutterfire' is not recognized错误 问题重现
执行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 + CategoryInfo : ObjectNotFound: (flutterfire:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
解决步骤
激活flutterfire_cli工具
执行以下命令确保工具已激活:dart pub global activate flutterfire_cli执行后会提示已激活最新版本,但会指出Pub的可执行文件目录(如
C:\Users\YASH\AppData\Local\Pub\Cache\bin)不在系统Path环境变量中。添加路径到账户级环境变量
- 打开控制面板,进入系统和安全 → 系统 → 高级系统设置
- 在弹出的「系统属性」窗口中,切换到高级标签页,点击「环境变量」
- 在「用户变量」区域找到
Path变量,点击「编辑」 - 点击「新建」,输入你的Pub可执行文件目录(替换成自己的用户名,例如
C:\Users\你的用户名\AppData\Local\Pub\Cache\bin) - 依次点击「确定」保存所有设置
重启终端并验证
关闭当前所有终端窗口,重新打开后执行flutterfire configure,命令即可正常运行。
内容的提问来源于stack exchange,提问作者Yash Shah
相关产品推荐
相关产品推荐

