While deploying a NextJS site, I was faced with the following error logs:
15:16:26.839 Initializing build environment. This may take up to a few minutes to complete
15:18:25.772 Success: Finished initializing build environment
15:18:25.772 Cloning repository...
15:18:29.002 Success: Finished cloning repository files
15:18:29.948 Installing dependencies
15:18:29.950 Python version set to 2.7
15:18:30.403 Attempting node version 'v16.13.2' from .nvmrc
15:18:31.034 Downloading and installing node v16.13.2...
15:18:31.169 Downloading https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.xz...
15:18:31.396 Computing checksum with sha256sum
15:18:31.517 Checksums matched!
15:18:34.046 Now using node v16.13.2 (npm v8.1.2)
15:18:34.117 Started restoring cached build plugins
15:18:34.120 Finished restoring cached build plugins
15:18:34.239 Attempting ruby version 2.7.1, read from environment
15:18:35.165 Using ruby version 2.7.1
15:18:35.406 Using PHP version 5.6
15:18:35.435 5.2 is already installed.
15:18:35.440 Using Swift version 5.2
15:18:35.441 Started restoring cached node modules
15:18:35.443 Finished restoring cached node modules
15:18:35.717 Installing NPM modules using NPM version 8.1.2
15:18:41.515 npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
15:18:41.612 npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
15:18:41.675 npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
15:18:42.211 npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
15:18:43.111 npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
15:18:47.633 npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
15:18:53.012
15:18:53.012 added 909 packages, and audited 910 packages in 17s
15:18:53.012
15:18:53.012 121 packages are looking for funding
15:18:53.012 run `npm fund` for details
15:18:53.028
15:18:53.028 9 high severity vulnerabilities
15:18:53.028
15:18:53.028 To address issues that do not require attention, run:
15:18:53.028 npm audit fix
15:18:53.028
15:18:53.028 To address all issues (including breaking changes), run:
15:18:53.028 npm audit fix --force
15:18:53.028
15:18:53.028 Run `npm audit` for details.
15:18:53.052 NPM modules installed
15:18:53.354 Installing Hugo 0.54.0
15:18:53.767 Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
15:18:53.769 Started restoring cached go cache
15:18:53.772 Finished restoring cached go cache
15:18:53.797 go version go1.14.4 linux/amd64
15:18:53.801 go version go1.14.4 linux/amd64
15:18:53.802 Installing missing commands
15:18:53.802 Verify run directory
15:18:53.803 Executing user command: next build && next export
15:18:54.409 warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
15:18:54.451 Attention: Next.js now collects completely anonymous telemetry regarding usage.
15:18:54.451 This information is used to shape Next.js' roadmap and prioritize features.
15:18:54.451 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
15:18:54.451 https://nextjs.org/telemetry
15:18:54.451
15:18:54.492 info - Checking validity of types...
15:19:00.788 info - Creating an optimized production build...
15:19:01.224 info - Attempted to load @next/swc-linux-x64-gnu, but it was not installed
15:19:01.224 info - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
15:19:01.224 info - Attempted to load @next/swc-linux-x64-musl, but it was not installed
15:19:01.224 error - Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
15:19:01.243 Failed: build command exited with code: 1
These logs are related to the way NextJS minifies bundles using a Rust tool called SWC. For this to work, certain binaries need to exist on the host machine (as explained here). It looks like these binaries are not available on the build image used by Cloudflare Pages.
Is there any way for me to add these binaries, perhaps by customizing the image used to build my Cloudflare Pages site?