Ken Yip
Ken Yip

Reputation: 761

Using Pnpm with SAM

I am using PNPM to manage my project and I want to deploy my server app as a Lambda function using SAM. My project structure is organised as follows:

- apps
 - server
- packages
 - core
 - utils

However, when I run sam build, the node_modules folder is not included, which prevents me from running my program. Is it possible to use PNPM with SAM or do I need to switch to NPM for my deployment process?"

Upvotes: 0

Views: 1006

Answers (1)

Ken Yip
Ken Yip

Reputation: 761

There is a viable solution to this problem. To dereference the symbolic links present in the node_modules folder, we can utilise the rsync command. Executing the following command will achieve the desired result:

rsync -a --copy-links build-folder destination-folder

This command performs a copy of the contents from build-folder to destination-folder, while simultaneously preserving symbolic links as the files they reference.

With this step completed, we can proceed to package all necessary components for deployment to Amazon by running the sam build command.

Upvotes: 1

Related Questions