aws-amplify / aws-amplify/amplify-hosting

[Next.js] build failed when using PnP of Yarn Berry

Open
#3,439 1 comment 2 reactions 0 assignees View on GitHub
compute question
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting questions](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d3hnphv5vamg3g

### AWS Region

ap-northeast-2

### Amplify Hosting feature

Deployments

### Question

after i implemented PnP of Yarn Berry in project, local build & CI is fine.
but, During the deployment process through Amplify, i encountered the following error:

```
"!!! CustomerError: The 'node_modules' folder in the standalone directory (/codebuild/output/src447661411/src/~~~/.next/standalone) is missing the 'next' dependency. This is required at runtime to run your application. If you are using a monorepo framework, you may need to do additional setup to ensure the necessary runtime dependencies are included in the standalone output directory. Read more: https://github.com/aws-amplify/amplify-hosting/blob/main/FAQ.md#using-a-monorepo-framework".text
```

Since the build and deployment process was successful before introducing PnP, it is suspected that the error occurred due to the introduction of PnP. The disappearance of the node_modules folder after using PnP seems to be the cause of the issue, and i'm not sure how to resolve it.

Contributor guide

Open the contributing guide

Research direction

Start with the deployment handling for Next.js standalone output and compare it with the Yarn Berry PnP setup described in the report. Review the linked FAQ section on monorepo frameworks and the reported missing next dependency in .next/standalone. Done means an Amplify deployment succeeds with PnP enabled and the runtime dependency is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, next.js
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.