Firebase-tools: verifyDeveloperNodeModules()无法发现“ firebase-admin”

创建于 2019-05-09  ·  26评论  ·  资料来源: firebase/firebase-tools

相关问题

1243和#1258

[必需]版本信息

节点: 8.16.0

firebase功能: 2.3.0

firebase-tools: 6.9.1(注:适用于6.8.0)

firebase-admin: 7.3.0

我正在Windows 10上运行它。

[必需]测试用例


使用firebase init和函数的新生成的firebase项目。

[需要]重现步骤

  1. 运行npm run start (或firebase functions:shell

[所需]预期行为


模拟器正确启动

[必要]实际行为

显示以下日志:

!  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)

您是否能够成功部署功能?


是的,部署工作正常。 部署的功能(Hello World)

emulator-suite bug

最有用的评论

这是firebase-tools版本6.9.06.9.1 。 解决方案是暂时降级为6.8.0

npm install -g [email protected]

参考: https :

所有26条评论

我不知道如何标记这个问题,所以我将其标记为便于分类。 等一下

移至firebase-tools,因为它是实现仿真的地方。

模拟器可在[email protected] 。 此问题可能与#1243和#1258有关

遇到相同的问题:

✔  functions: Using node<strong i="6">@8</strong> from host.
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
⚠  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)
firebase -V
6.9.1
  "dependencies": {
    "firebase-admin": "^7.3.0",
    "firebase-functions": "^2.3.0"
  },

尽管firebase-admin软件包确实存在于node_modules中。

[2019-05-09T09:19:26.091Z] ----------------------------------------------------------------------
[2019-05-09T09:19:26.093Z] Command:       /home/yerzhan/node-v8.12.0-linux-x64/bin/node /home/yerzhan/node-v8.12.0-linux-x64/bin/firebase emulators:start --debug
[2019-05-09T09:19:26.093Z] CLI Version:   6.9.1
[2019-05-09T09:19:26.093Z] Platform:      linux
[2019-05-09T09:19:26.093Z] Node Version:  v8.12.0
[2019-05-09T09:19:26.094Z] Time:          Thu May 09 2019 15:19:26 GMT+0600 (+06)
[2019-05-09T09:19:26.094Z] ----------------------------------------------------------------------

[2019-05-09T09:19:26.099Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-05-09T09:19:26.099Z] > authorizing via signed-in user
[2019-05-09T09:19:26.100Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2019-05-09T09:19:26.100Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[2019-05-09T09:19:26.891Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:26 GMT, server=scaffolding on HTTPServer2, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-05-09T09:19:26.901Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/azan-kz-ask-imam  

[2019-05-09T09:19:28.625Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:28 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=923, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
i  Starting emulators: ["functions"]
✔  functions: Using node<strong i="5">@8</strong> from host.
[2019-05-09T09:19:28.637Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/674391970261:getServerAppConfig  

[2019-05-09T09:19:29.356Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:29 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
[2019-05-09T09:19:29.813Z] Functions runtime initialized.
[2019-05-09T09:19:29.813Z] Disabled runtime features: undefined
⚠  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)

我有相同的发现解决方案:
您可以使用如下别名命令:“ yarn serve”或“ npm serve”
它将从“ scripts”块中的packages.json中调用

同样的问题在这里! 试图在3小时内找到解决方法,但没有成功。
今天,我只是想将firebase-admin添加到全局npm,但是不确定是否应该工作。
将尝试您的建议@namcoder

@diogolessa降级到

当然可以。看起来是更好的方法。 不过,让所有最新版本对像我这样的初学者而言都可以正常工作会很高兴。 谢谢@ExtraBB

同样在这里...它也在Linux上发生。

编辑:降级“修复”已确认。

我遇到了这个问题,因此删除了firebase-tools,然后重新安装了[email protected]

相同的问题..降级是使其工作的唯一方法

仅当前有效的设置
firebase功能:2.3.0
firebase-tools:6.8.0
firebase-admin:7.3.0

大家好,对于这个问题引起的麻烦深表歉意。 目前,我们建议在处理补丁时降级为6.8.0

此问题是由于在verifyDeveloperNodeModules()中使用本机require.resolve ,其中应使用slowRequireResolve 。 本机require.resolve其他用法也将遇到相同的问题。

这在我们的测试中没有得到解决,因为在测试中运行时require.resolve解析为firebase-tools的dev依赖关系,因此看起来require.resolveslowRequireResolve

这是firebase-tools版本6.9.06.9.1 。 解决方案是暂时降级为6.8.0

npm install -g [email protected]

参考: https :

感谢您的更新。 降级到6.8.0对我们有用

Firebase文档中,当前尚未在要这样做

好的,我们已经合并了一个修复程序,该修复程序今天将在6.9.2中发布。 在发布之前,我们可能会等待#1265的修复程序,但是如果仍不能解决问题,则此修复程序将消失。 一旦发现,我将关闭此错误,但如果问题仍然存在,请重新打开。

由#1263修复

此修复程序已发布版本6.9.2

得到以下错误,想知道它是否与此新版本有关:

AssertionError [ERR_ASSERTION]: missing path
    at Module.require (module.js:595:3)
    at require (internal/module.js:11:18)
    at InitializeFirebaseAdminStubs

从6.8.0升级到6.9.2,现在看到:

功能:从主机使用node @ 8

! 云功能仿真器需要将模块“ firebase-functions-test”安装为开发依赖项。 要解决此问题,请在您的functions目录中运行“ npm install --save-dev firebase-functions-test”。
i函数:由于您的node_modules问题而导致无法解析您的函数(请参见上文)

升级到6.9.2后出现很多错误。

  1. https://github.com/firebase/firebase-tools/issues/1106
  2. https://github.com/firebase/firebase-tools/issues/1265
    尝试解决现有漏洞后又发现了一些错误。
    此次升级的方式更加复杂。 必须降级到6.8.0

此修复程序已发布6.9.2版。

修复不成功。 我们在"firebase-tools": "^6.10.0"中看到此错误。

云功能模拟器要求模块“ firebase-admin”的版本> 7.0.0,因此您的版本太旧了。 您可能可以通过在功能目录中运行“ npm install firebase-admin @ latest ”来解决此问题。

我们目前已从package.json依赖项中删除^ ,以防止安装时自动升级。

"firebase-tools": "^6.8.0", // before
"firebase-tools": "6.8.0", // after

@diogolessa降级到

谢谢,对我有用

此页面是否有帮助?
0 / 5 - 0 等级