程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了当函数目录位于不同的项目/位置时运行 firebase 模拟器大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决当函数目录位于不同的项目/位置时运行 firebase 模拟器?

开发过程中遇到当函数目录位于不同的项目/位置时运行 firebase 模拟器的问题如何解决?下面主要结合日常开发的经验,给出你关于当函数目录位于不同的项目/位置时运行 firebase 模拟器的解决方法建议,希望对你解决当函数目录位于不同的项目/位置时运行 firebase 模拟器有所启发或帮助;

我在 windows 10 机器上本地运行所有 firebase 模拟器。 但是,我正在单独运行我的函数模拟器,因为函数目录位于不同的项目/位置。 似乎没有模拟触发器,我收到以下警告。除了触发器/后台功能外,一切似乎都正常。

有什么解决办法吗?

i  emulators: StarTing emulators: functions
!  hub: emulator hub unable to start on port 4400,starTing on 4401 instead.
!  emulators: It seems that you are running multiple instances of the emulator suite for project myproject-dev. This may result in unexpected behavior.
!  functions: The following emulators are not running,calls to these services from the Functions emulator will affect production: auth,firestore,database,hosTing,pubsub
!  Your requested "node" version "10" doesn't match your global version "12"
!  logging: Logging Emulator unable to start on port 4500,starTing on 4501 instead.
!  ui: Emulator UI unable to start on port 4000,starTing on 4003 instead.
i  ui: Emulator UI logging to ui-deBUG.log
i  functions: Watching "R:\myproject\myprojectCloud\functions" for Cloud Functions...
!  functions: The Cloud Firestore emulator is not running,so calls to Firestore will affect production.
i  functions[memberupdate]: function ignored because the firestore emulator does not exist or is not running.

更新: 我的文件夹结构。

  1. R:/customer/customer-cloud-project/functions
  2. R:/cusomer/customer-web-app/

我可以正常运行位置 2 中的所有模拟器,除了函数模拟器,因为没有函数目录。 所以我在函数文件夹的位置 1 中运行以下命令: firebase 模拟器:启动 --only 功能

这运行良好,因为它运行了 2 个模拟器实例。但是,触发器/后台功能不会运行,因为它找不到在不同端口上运行的 Firestore 模拟器。

解决方法

对此的解决方案是使用符号链接。 这基本上是位于函数项目中另一个目录的快捷方式。

如果其他人想这样做,Windows 上的命令是: mklink /D "R:\firestore-project\functions" "R:\cloud-functions-proj\functions"

您需要以管理员身份运行命令提示符。

在此处查看我的问题以获取更多详细信息: https://github.com/firebase/firebase-tools/issues/3092#issuecomment-771159457

注意: 创建符号链接时可以指定绝对路径或相对路径。 相对是最好的选择,否则它不太可能在其他人的环境中工作。在要创建链接的目录中运行此命令:

@H_242_7@mklink /D "models" "..\..\..\myapp\src\app\models"

大佬总结

以上是大佬教程为你收集整理的当函数目录位于不同的项目/位置时运行 firebase 模拟器全部内容,希望文章能够帮你解决当函数目录位于不同的项目/位置时运行 firebase 模拟器所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。