Unverified Commit 93dc872d authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

Generate a CLI warning if using Rosetta 2 on Apple Silicon (#92220)

This PR is AI generated.

Test plan (following https://github.com/vercel/next.js/pull/81950):

- Build a preview deployment:
https://github.com/vercel/next.js/actions/runs/23858712091/job/69559813673
- Enable Rosetta
- Download a standalone x64 macos binary from
https://nodejs.org/en/download

```
export PATH=/Users/bgw/Downloads/node-v22.17.1-darwin-x64/bin/:"$PATH"`
pnpm dlx create-next-app@canary --yes intel-app
cd intel-app
nvim package.json # edit the next.js version to point to the preview deployment
pnpm i
pnpm dev
```

<img width="723" height="192" alt="Screenshot 2026-04-01 at 9 25 04 AM"
src="https://github.com/user-attachments/assets/a953ef8f-7fee-4aa0-9ef8-36ef667de734"
/>

<img width="1022" height="278" alt="Screenshot 2026-04-01 at 9 26 35 AM"
src="https://github.com/user-attachments/assets/a0d4b3bd-f8b7-4bbc-a7be-9113dabe189f"
/>

(the bmi2 issue should be fixed by
https://github.com/vercel/next.js/pull/92177, I just hadn't rebased)

---------
Co-authored-by: 's avatarBenjamin Woodruff <bgw@users.noreply.github.com>
Co-authored-by: 's avatarClaude <noreply@anthropic.com>
parent a6df8603
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import '../server/require-hook' import '../server/require-hook'
import os from 'os'
import { import {
Argument, Argument,
Command, Command,
...@@ -89,6 +90,16 @@ class NextRootCommand extends Command { ...@@ -89,6 +90,16 @@ class NextRootCommand extends Command {
;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv ;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
;(process.env as any).NEXT_RUNTIME = 'nodejs' ;(process.env as any).NEXT_RUNTIME = 'nodejs'
if (
process.platform === 'darwin' &&
process.arch === 'x64' &&
os.cpus().some((cpu) => cpu.model.includes('Apple'))
) {
warn(
'You are running Next.js on an Apple Silicon Mac with Rosetta 2 translation, which may cause degraded performance.'
)
}
if ( if (
commandName !== 'dev' && commandName !== 'dev' &&
commandName !== 'start' && commandName !== 'start' &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment