Firebase-tools: 无法启动模拟器

创建于 2017-12-01  ·  42评论  ·  资料来源: firebase/firebase-tools

当我尝试运行 firebase serve --only 功能
它给出以下错误并仅运行托管
functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'

最有用的评论

当您的节点版本与package.json中的节点引擎不同时遇到相同的问题
解决方案:

下面是yarn,随意使用npm

# install current working directory dependencies
yarn --ignore-engines

# install firebase-tools if u didn't
yarn global add firebase-tools

# install functions-emulator
yarn global add @google-cloud/functions-emulator --ignore-engines

所有42条评论

当您安装firebase-tools时,听起来模拟器可能无法安装(这是一个可选的依赖项,所以有可能)。 您可以尝试重新运行npm install -g firebase-tools并检查输出以确认@google-cloud/functions-emulator是否被拉入?

平? 希望收到您的回复,否则我们将因不活动而关闭

我做了同样的事情,我安装并重新安装了模块无济于事。

➜ firebase serve --only 功能

=== 服务于 ''...

⚠ 功能:无法启动模拟器。 错误:找不到模块“@google-cloud/functions-emulator/src/config”
➜ npm install -g firebase-tools
npm WARN 已弃用[email protected] :改用 uuid 模块
/家//.npm-global/bin/firebase -> /home//.npm-global/lib/node_modules/firebase-tools/bin/firebase

=== 服务于 ''...

⚠ 功能:无法启动模拟器。 错误:找不到模块“@google-cloud/functions-emulator/src/config”

同样在这里。 这几天一直这样。 即使在今天更新之后。

@danielsada@raelmiu你能试试:

npm 卸载 -g firebase-tools && npm i -g firebase-tools

做到了,一些值得注意的警告:
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node-v59-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp) make: Entering directory '/home/danielsada/.npm-global/lib/node_modules/firebase-tools/node_modules/grpc/build'
然后

`> @google-cloud/ functions [email protected] postinstall /home//.npm-global/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator

节点脚本/升级警告`

最后,同样的错误

image

我遇到了同样的错误。 已尝试卸载并重新安装。

有没有人得到这个工作? 仍然得到同样的错误。

screen shot 2018-01-25 at 12 59 38 pm

同样在这里。 安装了node 6.11,重新安装了工具,还是不行。

可以在 v3.17.2 中复制

大家好,可以试试v3.17.3吗? @Mir-Ansar 你的看起来是权限错误,以下是有关如何修复的信息: https ://docs.npmjs.com/getting-started/fixing-npm-permissions

我尝试了 .3 和 .2,但我得到了同样的错误:(

有什么解决办法吗?

抱歉,我无法重现该问题,听起来它类似于https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/170#issue -278096938。 因此,您可能想对该问题 +1。

您可以尝试的其他事情是:

  • 升级npm,然后卸载,重新安装
npm i -g npm
npm unintall -g firebase-tools && npm i -g firebase-tools

我有同样的确切问题,尝试了大多数给定的解决方案,但没有任何效果。 在此期间有人有解决方案吗?

我遇到了同样的错误

我不确定究竟是什么导致了这个问题。 但这里是这个问题的有效解决方案。 StackOverflow - Firebase:无法启动模拟器

npm install -g @google-cloud/functions-emulator为我解决了这个问题。

@RyanNewsom没有为我解决这个问题。 还是坏了。

任何可行的解决方案? 我的模拟器可以工作,但现在不行

我有几个类似的项目,一个正在工作,一个没有按照上述评论工作,还有一个正在工作的 firebase 部署 - 现在莫名其妙地不起作用。 在长达数月的时间里,在这里和在 stackOverflow 上遭受同样命运的人数众多,似乎需要一个不那么脆弱的系统。

在大多数情况下,这个问题的原因是安装 firebase 时使用了错误的 python 版本。

确保您使用的是带有python 2的 shell,然后重新运行:
npm install -g firebase-tools

最新的 firebase-tools (v3.17.5) 删除了 grpc 作为依赖项,这应该可以解决这些问题。 请通过运行npm i -g firebase-tools进行升级

为我修好了。

当您的节点版本与package.json中的节点引擎不同时遇到相同的问题
解决方案:

下面是yarn,随意使用npm

# install current working directory dependencies
yarn --ignore-engines

# install firebase-tools if u didn't
yarn global add firebase-tools

# install functions-emulator
yarn global add @google-cloud/functions-emulator --ignore-engines
⚠  functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
(node:15281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

尝试了@ddo方法,但没有奏效。

⚠  functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
(node:15281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

尝试了@ddo方法,但没有奏效。

工作后,我:

  1. 使用 NVM 重新安装 Node 和 NPM
  2. 删除/usr/local/lib/node_modules上的 firebase-tools(或从根级节点安装的以前的全局包)
  3. 在没有sudo ( npm i -g firebase-tools ) 的情况下安装 firebase-tools

sdfsdfadf

我最近也升级到使用节点 8,并且遇到了firebase serve --only functionsfirebase-tools不愿意完全安装@google-cloud/[email protected]: The engine "node" is incompatible with this module. Expected version "~6". Got "8.1.0"的问题,但是--ignore-engines真的很有帮助 - 现在它运行良好,但会发出警告

[Jest Dev server] $ firebase serve --only functions -p 5000 -o 0.0.0.0
[Jest Dev server]
[Jest Dev server] === Serving from '/Users/xxx/project-name'...
[Jest Dev server]
[Jest Dev server] i  functions: Preparing to emulate functions.
[Jest Dev server] Warning: You're using Node.js v8.1.0 but Google Cloud Functions only supports v6.11.5.

问题解决了,我只是停止使用firebase。 而已。

2018 年 11 月 14 日星期三凌晨 1:03 rilian [email protected]写道:

我最近也升级到使用节点 8 并且遇到了 firebase 问题
serve --only 功能和 firebase-tools 不愿意完全安装
@google-cloud/ functions [email protected]:引擎“节点”是
与此模块不兼容。 预期版本“~6”。 得到“8.1.0”,但是
--ignore-engines 真的很有帮助 - 现在它运行良好,虽然给出了一个
警告

[Jest Dev server] $ firebase serve --only functions -p 5000 -o 0.0.0.0
[Jest 开发服务器]
[Jest Dev server] === 服务于 '/Users/xxx/project-name'...
[Jest 开发服务器]
[Jest Dev server] i 函数:准备模拟函数。
[Jest Dev server] 警告:您使用的是 Node.js v8.1.0,但 Google Cloud Functions 仅支持 v6.11.5。


您收到此消息是因为您发表了评论。
直接回复此邮件,在 GitHub 上查看
https://github.com/firebase/firebase-tools/issues/552#issuecomment-438375329
或使线程静音
https://github.com/notifications/unsubscribe-auth/Acq9nGZycDnglAuFYQiMNNVaQX9XEyTRks5uuwl-gaJpZM4Qx6cx
.

救救我:
yarn global remove @google-cloud/functions-emulator
yarn global add https://github.com/GoogleCloudPlatform/cloud-functions-emulator#master

在升级 firebase-admin 和其他一些 firebase 软件包后,我也遇到了这个问题。 我在节点 8 上运行函数。我能够通过确保使用--ignore-engines安装 firebase 来解决此问题

如果您主要在项目中使用 yarn,请在安装 firebase-tools 时使用 npm 而不是 yarn。

yarn global remove firebase-tools
npm i - g firebase-tools

为我工作:我在 mac 上的 docker 中遇到了这个问题。 没有什么能解决它。 最终将其安装在 mac 上,然后将其复制到 docker 的node_modules中。 那行得通。

迁移到节点 8 功能后也存在上述问题。 如前所述,使用--ignore-engines ,尽管我仍然收到此警告:

警告:您使用的是 Node.js v8.14.0,但 Google Cloud Functions 仅支持 v6.11.5。

@Dygerati对我​​来说也一样。

这是我得到的,有人解决了这个问题吗?

functions: Cannot start emulator. Error: Cannot find module './acceleratedmobilepageurl/v1'
(node:16724) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at C:\....\node_modules\firebase-tools\lib\command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rej
ection id: 2)
(node:16724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

npm install @google-cloud/functions-emulator --save-dev为我解决了

好的,谷歌云功能模拟器“仅支持 Node v6.xx 它不支持 Node v8.xx”
https://github.com/GoogleCloudPlatform/cloud-functions-emulator#note

关于选择节点版本的 firebase 文档说您可以使用节点 8 "engines": {"node": "8"}
但它处于测试阶段..
https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version

嗯...所以我可以使用 node8,但我无法使用云函数 shell 在本地测试它(如果我使用 node8 特定的语法)?
我有这个权利吗?

Firebase 团队/Google 团队,如果您将文档中的云功能模拟器不适用于节点 8,将会很有帮助
例如在这个页面上, https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version有类似

“您可以将运行时设置为节点 8,但如果您使用 google cloud-functions-emulator 进行测试,它将使用 node6.xx 并且任何特定于 node8 的语法都将不起作用”

这里的类似警告会有所帮助
https://firebase.google.com/docs/functions/local-emulator#install_and_configure_the_cloud_functions_shell

也在您发送的电子邮件中(2019 年 2 月 25 日)
主题:[需要采取行动] 从 4 月 1 日起对新 Cloud Functions 部署的运行时进行更改

我带着与@julianorinyol完全相同的问题来到这里 - 是否有计划让模拟器达到与 Node 8 语法兼容的程度?

在节点 8(使用纱线)上使用这对我有用:
yarn add @google-cloud/functions-emulator --ignore-engines

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