簡體   English   中英

當函數目錄位於不同的項目/位置時運行 firebase 模擬器

[英]Running the firebase emulators when the functions directory is in a different project/location

我在 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:/客戶/客戶雲項目/功能
  2. R:/客戶/客戶網絡應用程序/

我可以運行位置 2 中的所有模擬器,除了函數模擬器,因為沒有函數目錄。 所以我在函數文件夾的位置 1 中運行以下命令:firebase emulators:start --only functions

這工作正常,因為它運行模擬器的 2 個實例。 但是,觸發器/后台功能不會運行,因為它找不到在不同端口上運行的 firestore 模擬器。

對此的解決方案是使用符號鏈接。 這基本上是指向函數項目中另一個目錄的快捷方式。

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

您將需要以管理員身份運行命令提示符。

在這里查看我的問題以獲取更多詳細信息: https://github.com/firebase/firebase-tools/issues/3092#issuecomment-771159457

注意:您可以在創建符號鏈接時指定絕對路徑或相對路徑。 相對是最好的選擇,否則它不太可能在其他人的環境中工作。 在要創建鏈接的目錄中運行:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM