When creating custom serverless template, "ServerlessError: serverless.yml not found" Error

When creating custom serverless template, "ServerlessError: serverless.yml not found" Error

我已尝试创建自定义无服务器模板。

就是让我做过的所有serverless项目共享同一个文件结构

$ serverless create --template-url https://git-repository-url --path myService

以下是 serverless 模板的 git 存储库结构。

但是,当我运行上面的命令时,它returns错误。

Serverless: Downloading and installing "xxxxxxxxxxx"...

  Serverless Error ---------------------------------------

  serverless.yml not found in /......../myService

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           10.6.0
     Serverless Version:     1.32.0

我哪里做错了?

如果我克隆存储库,我可以在根目录中看到一个 severless.yml 文件。

我认为 create 函数不会像您期望的那样工作,即它不会从 URL.

中提取一个 repo

来自docs

Creating a new service using a local template

serverless create --template-path path/to/my/template/folder --path path/to/my/service --name my-new-service

首先将您的存储库克隆到本地机器上,然后 运行 使用本地路径 create 命令

我应该使用 git 源路径 URL 而不仅仅是 git 存储库 URL.

# For github
https://github.com/user/repository-name/tree/branch-name/dir-path

# For bitbucket
https://bitbucket.com/user/repository-name/src/branch-name/dir-path