【问题标题】:Error converting YAML to JSON: yaml: line 3: did not find expected key [closed]将 YAML 转换为 JSON 时出错:yaml:第 3 行:未找到预期的密钥 [关闭]
【发布时间】:2020-05-02 03:43:55
【问题描述】:

我准备了一个 docker 应用程序。现在我想在服务器heroku上实现它,不幸的是,在命令执行过程中返回一个错误。

git push heroku master

我收到此错误消息

Enumerating objects: 466, done.
Counting objects: 100% (466/466), done.
Delta compression using up to 4 threads
Compressing objects: 100% (442/442), done.
Writing objects: 100% (466/466), 10.30 MiB | 1008.00 KiB/s, done.
Total 466 (delta 83), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: === Fetching app code
remote: 
remote: =!= Build failed due to an error:
remote: 
remote: =!= validate step: error converting YAML to JSON: yaml: line 3: did not find expected key
remote: 
remote: If this persists, please contact us at https://help.heroku.com/.
remote: Verifying deploy...
remote: 
remote: !   Push rejected to powerful-cove-75131.
remote: 
To https://git.heroku.com/powerful-cove-75131.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/powerful-cove-75131.git'

我的 heroku.yml 文件如下所示

setup:
  addons:
  - plan: heroku-postgresql
build:
  docker:
    web: Dockerfile
release:
  image: web
  command:
    - python manage.py collectstatic --noinput
run:
  web: gunicorn pvb.wsgi

【问题讨论】:

    标签: python django docker heroku docker-compose


    【解决方案1】:

    根据this,缩进不匹配。应该是这样的,

        setup:
          addons:
            - plan: heroku-postgresql
              as: database
        build:
          docker:
            web: Dockerfile
        release:
          image: web
          command:
            - python manage.py collectstatic --noinput
        run:
          web: gunicorn pvb.wsgi
    

    【讨论】:

    • 我修好了,我的wsgi名字错了,改成正确的名字后,我没有加到git中。
    • @yellowhand 很高兴听到!是的,我用 linter 再次检查了 yaml,在这两种情况下似乎都很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-10
    • 2021-12-08
    • 2019-12-13
    • 2019-06-26
    • 2021-10-03
    相关资源
    最近更新 更多