A user following the bedrock-agent-cdk example in amazon-bedrock-samples hit a wall running cdk bootstrap. TypeScript refused to compile: error TS2307 Cannot find module 'path' (plus 'glob' and 'aws-cdk-lib'). They had already run npm install in the sample root, but it died with an ERESOLVE peer dependency conflict: @aws-cdk/aws-lambda-python-alpha@2.108.0-alpha.0 requires aws-cdk-lib ^2.108.0 while the project pinned aws-cdk-lib@2.87.0. Context: the bedrock-agent-cdk CDK example, CDK v2.
TSError: Unable to compile TypeScript, TS2307 Cannot find module 'path' deploying the bedrock-agent-cdk sample
- amazon-bedrock-samplesproduct
- bedrock-agent-cdkproduct
- CDKframework
- TypeScriptlanguage
- @aws-cdk/aws-lambda-python-alphalibrary
- npmtool
- +5 more
This is a peer dependency conflict in the sample's package set, not a broken install on your side. First run npm install from the bedrock-agent-cdk root directory before cdk bootstrap. If npm install fails with ERESOLVE (aws-cdk-lib@2.87.0 vs @aws-cdk/aws-lambda-python-alpha@2.108.0-alpha.0 wanting aws-cdk-lib ^2.108.0), run npm install --force to get past it. The reporter confirmed the deploy worked after that, and the sample README was updated to document the install step. The lambda-python-alpha construct is not actually needed and can be left out. Source: https://github.com/aws-samples/amazon-bedrock-samples/issues/40
Source: https://github.com/aws-samples/amazon-bedrock-samples/issues/40