【问题标题】:firebase deploy No files matching the pattern "'src/**/*'" were foundfirebase deploy 找不到与模式“'src/**/*'”匹配的文件
【发布时间】:2021-01-12 21:37:07
【问题描述】:

我试图在 firebase 上部署我的第一个云功能,但问题是它总是说有问题并且没有文件与模式匹配我不知道为什么即使 index.ts 是它应该在的位置 错误代码是

=== Deploying to 'mscmu-aeab1'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:\Users\fahmi\msc_mu\cloud_functions\functions
> eslint 'src/**/*'


Oops! Something went wrong! :(

ESLint: 7.9.0

No files matching the pattern "'src/**/*'" were found.
Please check for typing mistakes in the pattern.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ lint: `eslint 'src/**/*'`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\fahmi\AppData\Roaming\npm-cache\_logs\2020-09-26T22_01_33_578Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code2


https://i.imgur.com/rb10Tsi.png

【问题讨论】:

  • 请编辑问题以解释您为达到这一点而采取的全套步骤。它应该包含足够的细节,任何人都可以可靠地重现该问题。该错误消息表明您在“src”下没有要部署的源代码。
  • 但我确实有,正如我所说,我有一个 index.ts 文件和其中的云函数
  • 这看起来是因为您使用的是 Windows,并且 CLI 的新函数模板不支持它。

标签: node.js firebase google-cloud-functions firebase-cli


【解决方案1】:

此问题已通过 Firebase CLI version 8.12.0 解决。更新是将参数周围的引号转义为 eslint,如 this commit 所示。

【讨论】:

    【解决方案2】:

    thiscommit 解决了这个问题。

    在您的functions 文件夹中打开package.json 并编辑以lint 开头的行,如下所示:

    "lint": "eslint \"src/**/*\""
    

    【讨论】:

      【解决方案3】:

      在您的函数package.json 中编辑lint 脚本,如下所示:

      eslint --ext .ts src
      

      【讨论】:

      • 将 blob 更改为 src 也很重要,但为什么呢?
      • eslint 实际上支持这两种语法。如果您更喜欢使用 glob 模式,则需要转义 \"s 以使其在 Linux 和 Windows 上都可以工作。 - eslint.org/docs/user-guide/command-line-interface
      猜你喜欢
      • 2021-01-20
      • 2021-03-16
      • 2013-10-19
      • 1970-01-01
      • 2020-08-05
      • 2022-10-07
      • 2021-04-13
      • 1970-01-01
      相关资源
      最近更新 更多