npmtypescript95% confidence\u2191 9

AWS SAM - Esbuild Failed: cannot find esbuild

Full error message
I'm trying out AWS SAM with nodeJS and Typescript using 'sam init', but when I want to build the example hello-world-typescript application using 'sam build', I get the following message:

Building codeuri: C:\RF\GitHub\rf-09-06\hello-world runtime: nodejs14.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}} architecture: x86_64 functions: ['HelloWorldFunction']
Running NodejsNpmEsbuildBuilder:CopySource
Running NodejsNpmEsbuildBuilder:NpmInstall
Running NodejsNpmEsbuildBuilder:EsbuildBundle

Build Failed
Error: NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed: cannot find esbuild

Any idea how to resolve it?

Thanks!

It can be solved in either of the 2 ways: Install esbuild globally using npm install -g esbuild As mentioned in the AWS SAM github issues, move esbuild to non-dev dependency (npm install esbuild) - Since esbuild will bundle your code, it won't be packaged in your Lambda. PS: latest version of hello-world-typescript has this already corrected as mentioned in point 2.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/dd71cb49fd4fb09b788511d73625abab3be2ff3ae2c89aec8e8158f5e8c95cec
hash \u00b7 dd71cb49fd4fb09b788511d73625abab3be2ff3ae2c89aec8e8158f5e8c95cec
AWS SAM - Esbuild Failed: cannot find esbuild — DepScope fix | DepScope