我不是使用npm
和bitbucket-pipelines
的专家,但是我想在Bitbucket上创建管道以使用serverless
将我的python(烧瓶)项目部署到AWS Lambda。它正在本地部署,但是当我使用Bitbucket管道运行它时,会发生这种情况:
错误:找不到模块'/opt/atlassian/pipelines/agent/build/node_modules/fs-extra/lib/index.js'。请验证package.json是否具有有效的“主”条目
这是我的代码:
bitbucket-pipelines.yml
image: node:14.13.1-alpine3.10
pipelines:
branches:
master:
- step:
caches:
- node
script:
- apk add python3
- npm install
- npm install -g serverless
- serverless config credentials --stage dev --provider aws --key ${AWS_DEV_LAMBDA_KEY} --secret ${AWS_DEV_LAMBDA_SECRET}
- serverless deploy --stage dev
serverless.yml
service: serverless-flask
plugins:
- serverless-python-requirements
- serverless-wsgi
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
provider:
name: aws
runtime: python3.8
stage: dev
region: us-west-2
functions:
app:
handler: wsgi.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
alert:
handler: alerts.run
events:
- schedule: rate(1 day)
package:
exclude:
- .venv/**
- venv/**
- node_modules/**
- bitbucket-pipelines.yml
我该如何解决?
答案 0 :(得分:0)
我遇到了同样的问题,并通过(重新)安装fs-extra来解决了该问题
npm install fs-extra