简体   繁体   English

我如何避免 SAM 构建安装 devDependencies

[英]How do i avoid SAM build installing devDependencies

my current folder structure is as attached file.我当前的文件夹结构如附件所示。 it's a nodejs application and we use SAM to deploy in AWS.它是一个 nodejs 应用程序,我们使用 SAM 在 AWS 中部署。 each folder is a separate lambda function and it has devDependencies in package.json which really does not need to be bundled during SAM build.每个文件夹都是一个单独的 lambda function 并且它在 package.json 中有 devDependencies,在 SAM 构建期间确实不需要捆绑。 but as I understand the default behaviour of "sam build" is to install devDependencies as well.但据我了解,“sam build”的默认行为也是安装 devDependencies。 In my case this devDependcies are in the private repository so i need.npmrc file in each folder to make "sam build" command work.在我的例子中,这个 devDependcies 在私有存储库中,所以我需要每个文件夹中的 .npmrc 文件来使“sam build”命令工作。 but i really dont need these devDependencies as we use layers and all dependencies are stored in layers in my serverless application.但我真的不需要这些 devDependencies,因为我们使用层,所有依赖项都存储在我的无服务器应用程序的层中。 How do i make aws build ignore my dev dependencies?我如何让 aws build 忽略我的开发依赖? [1]: https://i.stack.imgur.com/91qd2.png [1]: https://i.stack.imgur.com/91qd2.png

What version of SAM are you using?您使用的是什么版本的 SAM? It used to be a bug with esbuild in older version of SAM, but should be fixed as of 1.56.0 : https://github.com/aws/aws-sam-cli/issues/4040它曾经是旧版本 SAM 中esbuild的一个错误,但应该从1.56.0https://github.com/aws/aws-sam-cli/issues/4040

暂无
暂无

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

相关问题 AWS 无服务器应用程序模型 (SAM) — 如何更改 StageName? - AWS Serverless Application Model (SAM) -- How do I change StageName? 使用 sam init 部署 AWS Lambda“Hello World”,sam build sam deploy defaults 失败,无法为 sam-app 创建变更集 - Deploying AWS Lambda "Hello World" using sam init, sam build sam deploy defaults fails with Failed to create changeset for sam-app 使用SAM时AWS sam build和sam package有什么区别? - What's the difference between AWS sam build and sam package when using SAM? 如何避免完整命令的 AWS CLI 完成 UI? - How do I avoid the AWS CLI completion UI for complete commands? AWS SAM 构建失败 NpmExecutionError 代码 255 - AWS SAM build failing NpmExecutionError code 255 有没有一种方法可以使用 AWS SAM 增量构建容器镜像? - Is there a way to incrementally build container images with AWS SAM? 如何使用 java 代码调用在 SAM localhost:3001 上运行的 AWS lambda function - How can I invoke a AWS lambda function running on SAM localhost:3001 using java code 如果它在 API 网关 DefinitionBody 中作为响应示例,我如何让空值传入 sam 模板 - How can I let a null values pass in a sam template if it is in an API Gateway DefinitionBody as a response example 我如何像无服务器框架一样使用 AWS SAM 模板文件分离? - How can i use AWS SAM Template File separation like Serverless Framework use? 如何使用 Node 从 SAM Lambda function 在 S3 中写入 json 文件 - How can I write a json file in S3 from a SAM Lambda function with Node
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM