Firebase Node.js提供错误“ AssertionError [ERR_ASSERTION]:缺少路径”

时间:2019-05-23 18:31:33

标签: node.js firebase-realtime-database google-cloud-functions firebase-admin

发出命令“ firebase serve --only functions,hosting”后获得以下错误消息

!  AssertionError [ERR_ASSERTION]: missing path
    at Module.require (module.js:594:3)
    at require (internal/module.js:11:18)
    at InitializeFirebaseAdminStubs (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:231:18)
    at C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:451:9
    at Generator.next (<anonymous>)
    at C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:3:12)
    at main (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:421:12)
    at Object.<anonymous> (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:511:5)
!  Your function was killed because it raised an unhandled error.
^CTerminate batch job (Y/N)? Y

下面是我执行的命令

  1. firebase服务-仅托管主机功能
    收到一条消息,我需要从6.4.0-> 6.9.2更新“运行npm i -g firebase-tools进行更新”

  2. 再次更新后,确实投放了服务并收到消息“更新可用6.9.2→6.10.0”,我再次进行了更新。

  3. 更新了firebase-admin以及“ npm i -g firebase-admin @ latest”

  4. 再次运行“ firebase服务-仅功能,托管”,开始在firebase-functions-test上看到以下消息。在功能文件夹中运行提到的命令。

+  functions: Using node@8 from host.
+  functions: Emulator started at http://localhost:5001
i  functions: Watching "D:\BigData\13. Firebase\FB-BTD\FB-BTD\functions" for Cloud Functions...
i  hosting: Serving hosting files from: public
+  hosting: Local server: http://localhost:5000
!  The Cloud Functions emulator requires the module "firebase-functions-test" to be installed as a development dependency. To fix this, run "npm install --save-dev firebase-functions-test" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)
[hosting] Rewriting / to http://localhost:5001/btd-in2-20180718/us-central1/app for local Function app
i  functions: Beginning execution of "app"
!  The Cloud Functions emulator requires the module "firebase-functions-test" to be installed as a development dependency. To fix this, run "npm install --save-dev firebase-functions-test" in your functions directory.
  1. 下次运行Firebase服务时,我收到了以上错误消息。

由于这个原因,我无法在本地测试web nodejs firebase代码。

2 个答案:

答案 0 :(得分:0)

Solution here

降级到6.8.0可行!

答案 1 :(得分:0)

更新节点版本!,您使用了最旧的版本。