Google cloud firestore 当functions目录位于不同的项目/位置时运行firebase模拟器

Google cloud firestore 当functions目录位于不同的项目/位置时运行firebase模拟器,google-cloud-firestore,google-cloud-functions,firebase-tools,Google Cloud Firestore,Google Cloud Functions,Firebase Tools,我正在windows 10计算机上本地运行所有firebase模拟器。 但是,我单独运行functions emulator,因为functions目录位于不同的项目/位置。 似乎没有模拟触发器,我得到下面的警告。除了触发/后台功能外,其他功能都正常工作 有什么解决办法吗 i emulators: Starting emulators: functions ! hub: emulator hub unable to start on port 4400, starting on 4401 i

我正在windows 10计算机上本地运行所有firebase模拟器。 但是,我单独运行functions emulator,因为functions目录位于不同的项目/位置。 似乎没有模拟触发器,我得到下面的警告。除了触发/后台功能外,其他功能都正常工作

有什么解决办法吗

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.
更新: 我的文件夹结构

  • R:/customer/客户云项目/功能
  • R:/cusomer/客户web应用程序/
  • 我可以在位置2很好地运行所有模拟器,除了functions emulator,因为没有functions目录。 因此,我在functions文件夹的位置1中运行以下命令: firebase模拟器:仅启动功能


    这可以正常工作,因为它运行2个仿真器实例。但是,触发器/后台函数不运行,因为它找不到在不同端口上运行的firestore emulator。

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

    如果其他任何人想要执行此操作,Windows上的命令是: mklink/D“R:\firestore项目\功能”“R:\cloud functions项目\功能”

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

    有关更多详细信息,请参见我的问题:

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

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

    您所说的“功能目录位于不同的项目/位置”是什么意思?您是否有多个项目,一个是Firestore,另一个是功能?您从哪个目录运行每个模拟器?您提供的信息越多,我们就越容易理解问题。现在我无法复制你的设置。我有两个项目。一个用于我的云函数,另一个用于我的前端应用程序,其中我还使用规则、索引等初始化了firestore。仿真器似乎需要与firestore项目位于同一项目中的“函数”目录,以便将它们一起运行。这说明了吗?向问题添加了更多信息是的,据我了解,“功能”目录必须与firestore项目位于同一个项目中。@marian.vladoi我找到了一个解决方案。下面添加。对于任何使用Mac OS的用户,您都可以使用
    ln-s.././path/to/functions
    注意:点和路径只是一个示例。更改为相对(或绝对)路径。此外,请记住更新firestore项目的firebase.json中的“source”字段,以指向符号链接文件夹。