【问题标题】:Error when deploying serverless application in python在 python 中部署无服务器应用程序时出错
【发布时间】:2022-02-16 13:44:55
【问题描述】:

在我登录 serverless account 然后我尝试部署我的应用程序(在亚马逊上)后, 它告诉我这个错误

    Error: `docker run --rm -v C:/Users/user/AppData/Local/UnitedIncome/serverless-python-requirements/Cache/3c5307946d60c3cf6dcd718de08a5ac453454387e6a435435edf993f360200a547cc_x86_64_slspyc:/var/task:z -v C:/Users/user/AppDa
ta/Local/UnitedIncome/serverless-python-requirements/Cache/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownload
Cache` Exited with code 1
      at ChildProcess.<anonymous> (C:\Users\user\Desktop\voice-reckognition\node_modules\child-process-ext\spawn.js:38:8)
      at ChildProcess.emit (node:events:390:28)
      at ChildProcess.emit (node:domain:475:12)
      at ChildProcess.cp.emit (C:\Users\user\Desktop\voice-reckognition\node_modules\cross-spawn\lib\enoent.js:34:29)
      at maybeClose (node:internal/child_process:1064:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

我的应用程序是 python 并且我已经安装了serverless-python-requirements,它是我的package.json,如下所示:

"devDependencies": {
    "serverless-python-requirements": "^5.3.0"
  }

还有在我的serverless.yml,我有这些:

plugins:
  - serverless-python-requirements


custom:
  pythonRequirements:
    dockerizePip: non-linux

这个怎么解决?

【问题讨论】:

    标签: amazon-web-services docker serverless serverless-framework


    【解决方案1】:

    如果您使用 serverless framework 进行部署,根据文档,当您要安装 serverless-python-requirements 时,您必须在终端上使用此行第一个serverless plugin install -n serverless-python-requirements。这会自动将插件添加到项目的 package.json 和它的 serverless.yml 的 plugins 部分。您不必手动执行此操作,因为您可能会在此过程中犯任何错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-21
      • 2018-11-30
      • 2013-02-07
      • 2020-07-04
      • 1970-01-01
      • 2016-04-15
      • 2020-04-26
      • 1970-01-01
      相关资源
      最近更新 更多