我最近将Flash babel添加到了我的无服务器Flask应用程序中,并且当我使用sls wsgi serve在本地运行时,一切正常。但是,当我运行无服务器部署时,打包步骤失败,并显示以下消息:
Unable to link dependency 'babel' because a file by the same name exists in this service
Stack Trace --------------------------------------------
Error: Unable to link dependency 'babel' because a file
by the same name exists in this service
at fse.readdirSync.map.e (/tmp/seed/source/node_modules/serverless-python-requirements/index.js:162:19)
at Array.map (native)
at ServerlessPythonRequirements.linkRequirements (/tmp/seed/source/node_modules/serverless-python-requirements/index.js:151:40)
From previous event:
at PluginManager.invoke (/sls-1.40.0/node_modules/serverless/lib/classes/PluginManager.js:408:22)
at PluginManager.run (/sls-1.40.0/node_modules/serverless/lib/classes/PluginManager.js:439:17)
at variables.populateService.then (/sls-1.40.0/node_modules/serverless/lib/Serverless.js:109:33)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at Serverless.run (/sls-1.40.0/node_modules/serverless/lib/Serverless.js:96:6)
at serverless.init.then (/sls-1.40.0/node_modules/serverless/bin/serverless:43:28)
at /sls-1.40.0/node_modules/graceful-fs/graceful-fs.js:111:16
at /sls-1.40.0/node_modules/graceful-fs/graceful-fs.js:45:10
at FSReqWrap.oncomplete (fs.js:123:15)
From previous event:
at initializeErrorReporter.then (/sls-1.40.0/node_modules/serverless/bin/serverless:43:6)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at __dirname (/sls-1.40.0/node_modules/serverless/bin/serverless:28:46)
at Object.<anonymous> (/sls-1.40.0/node_modules/serverless/bin/serverless:67:4)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
at bootstrap_node.js:507:3
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
OS: linux
Node Version: 6.17.0
Serverless Version: 1.40.0
我的需求文件如下:
click==6.7
Flask==0.12.3
itsdangerous==0.24
Jinja2==2.10.1
MarkupSafe==1.0
Werkzeug==0.12.2
pytest==3.7.2
requests
Flask-Login
pysaml2
flask_babel
任何帮助将不胜感激..谢谢..
答案 0 :(得分:0)
一些无服务器python要求的源代码阅读?事实证明,无服务器python要求会将所有依赖项下载到一个.requirements文件夹,然后从那里将符号链接到您的项目根文件夹。我已经有几个文件夹的名称与我使用的依赖项相同。
babel是我的babel.cfg文件所在的此类文件夹之一。重命名该文件夹后,错误消失了。