Skip to content

.next/node_modules directory ignored by EB CLI #74

Description

@chrisrhymes

I am trying to deploy a next.js v16 app to Elastic Beanstalk using this action. Here's a summary of my pipeline.

  • Run npm install to install dependencies
  • Run the next build command to build the next.js app
  • Use the aws-elasticbeanstalk-deploy action to deploy to elastic beanstalk environment

The package is deployed to the server, but the .next/node_modules directory is missing from the deployment.

I tried adding the following to the .ebignore. The .next directory is there but the .next/node_modules directory is still missing in the deployed app.

// .ebignore
## Ensure that the .next directory is NOT ignored!
!.next
!.next/node_modules 

Is there a way to force this directory to be included in the deployment package?

Manual zip package creation

I have also tried manually creating a zip of the build. This includes the .next/node_modules directory, but the files within the .next/node_modules directory are symlinks to the node_modules directory.

It seems that the deployment process first uses chown to change the permissions, but this fails as the files are symlinks and this runs before npm install is run on the EC2 instance and the destination of the symlink doesn't yet exist.

Is there a way of running npm install before the permissions are changed?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions