简体   繁体   English

AWS上的无服务器PHP出现bref部署错误

[英]Serverless PHP on AWS with bref deployment error

I recently discovered what promises to be the holy grail of PHP development on AWS Lambda. 我最近发现了什么有望成为AWS Lambda上PHP开发的圣杯。 It's a tool called "bref" which simplifies the way PHP apps are deployed to the cloud. 这是一个称为“ bref”的工具,可简化将PHP应用程序部署到云中的方式。

The online documentation has simple and clear instructions to follow here: https://bref.sh/docs/first-steps.html 联机文档具有简单明了的说明,可在此处遵循: https : //bref.sh/docs/first-steps.html

Unfortunately, I get the following error when deploying (sls deploy): 不幸的是,在部署(sls deploy)时出现以下错误:

Serverless plugin "./vendor/bref/bref" initialization errored: Cannot find module './vendor/bref/bref'
Require stack:
- /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js
- /usr/local/lib/node_modules/serverless/lib/Serverless.js
- /usr/local/lib/node_modules/serverless/lib/utils/autocomplete.js
- /usr/local/lib/node_modules/serverless/bin/serverless

This error appears to say that there are some missing npm packages but the documentation on the bref website does not address any additional packages to be installed. 出现此错误似乎是因为缺少一些npm软件包,但bref网站上的文档并未解决要安装的任何其他软件包。 What am I doing wrong here? 我在这里做错了什么?

I already had PHP version 7.3 installed. 我已经安装了PHP版本7.3。 The problem was having an old version of Serverless Framework. 问题是有一个旧版本的Serverless Framework。 But in order for me to upgrade my version of Serverless, I had to first upgrade NPM as well. 但是,为了让我升级我的Serverless版本,我还必须先升级NPM。

npm i -g npm

Then I could upgrade Serverless Framework: 然后,我可以升级无服务器框架:

npm install -g serverless@latest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM