ns-build is a CLI utility designed to simplify the build process for Next.js applications intended for serverless deployment on AWS using Terraform. It primarily functions as a bash script, automating the steps required to prepare a Next.js project (specifically those configured with `output: 'standalone'`) for deployment. The current stable version is 3.1.1. It maintains a consistent release cadence with updates to support newer Next.js versions (e.g., v15, v16) and Node.js runtimes (e.g., Node 22, Node 24) on AWS Lambda. Its key differentiator is its tight integration with the `nextjs-serverless` Terraform module, providing a streamlined workflow from build to infrastructure deployment without requiring manual asset compilation or environment setup for AWS Lambda and CloudFront distributions.
npm install ns-buildNo compatibility data collected yet for this library.
Demonstrates the package.json setup and `next.config.js` configuration for using `ns-build` with a Next.js project, followed by the build command.
Ensure your Next.js project is compatible with Next.js v16 or later and update your AWS Lambda configuration to use Node.js 24. For earlier Next.js versions, use ns-build v2.x or earlier.
Update your Next.js project to v15 or later and ensure your AWS environment supports Node.js 22 for Lambda functions. Consider upgrading to ns-build v3.x and Node.js 24 for the latest support.
Add `output: 'standalone'` to your `next.config.js` configuration file to ensure the build output is in the expected format for the tool.
Do not attempt to `import` or `require` symbols from `ns-build` in your JavaScript or TypeScript code. Interact with it solely as a command-line utility.
Verify that your `next` peer dependency is satisfied (e.g., `^16.0.0` for `ns-build` v3) and that `output: 'standalone'` is correctly configured in your `next.config.js`.
Inspect the detailed output preceding this error for specific Next.js build failures (e.g., linting errors, missing dependencies, incorrect configurations). Try running `next build` directly to isolate the issue.