vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.2k stars 27.02k forks source link

nextjs 15 codemod failed on headless linux #71535

Open mio-19 opened 1 month ago

mio-19 commented 1 month ago

Link to the code that reproduces this issue

https://github.com/chester-lang/chester/tree/a01bbf243258ff4a679f7df83ec0b67142de7749/site

To Reproduce

npx @next/codemod@canary upgrade rc on a exisiting next.js 14 project

Current vs. Expected behavior

Processing 21 files...
Spawning 11 workers...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 2 files to free worker...
Sending 1 files to free worker...
All done.
Results:
0 errors
21 unmodified
0 skipped
0 ok
Time elapsed: 0.545seconds
 WARN  3 deprecated subdependencies found: glob@7.2.3, inflight@1.0.6, rimraf@2.6.3
Packages: +303
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Downloading @ast-grep/cli-linux-x64-gnu@0.25.7: 7.33 MB/7.33 MB, done
Progress: resolved 339, reused 80, downloaded 223, added 303, done
.cache/pnpm/dlx/bd6mfpigkbwzyrlvutff2j2wqe/192a97fa005-5d3/node_modules/.pnpm/esbuild@0.23.1/node_modules/esbuild: Running postinstall script...
.cache/pnpm/dlx/bd6mfpigkbwzyrlvutff2j2wqe/192a97fa005-5d3/node_modules/.pnpm/@ast-grep+cli@0.25.7/node_modules/@ast-g.cache/pnpm/dlx/bd6mfpigkbwzyrlvutff2j2wqe/192a97fa005-5d3/node_modules/.pnpm/esbuild@0.23.1/node_modules/esbuild: Run.cache/pnpm/dlx/bd6mfpigkbwzyrlvutff2j2wqe/192a97fa005-5d3/node_modules/.pnpm/@ast-grep+cli@0.25.7/node_modules/@ast-g.cache/pnpm/dlx/bd6mfpigkbwzyrlvutff2j2wqe/192a97fa005-5d3/node_modules/.pnpm/keytar@7.9.0/node_modules/keytar: Running install script, done in 1.4s
Usage: <command> [options]

Commands:
  codemod            runs a codemod or recipe                                                                [default]
  codemod list       lists all the codemods & recipes in the public registry. can be used to search by name and tags
                                                                                                 [aliases: ls, search]
  codemod learn      exports the current `git diff` in a file to before/after panels in the Codemod Studio
  codemod login      logs in through authentication in the Codemod Studio
  codemod logout     logs out
  codemod whoami     prints the user data of currently logged in user
  codemod publish    publish the codemod to Codemod Registry
  codemod unpublish  unpublish previously published codemod from Codemod Registry
  codemod init       initialize a codemod package
  codemod feedback   submit feedback to the Codemod team

Options:
      --help            Show help                                                                            [boolean]
      --no-telemetry    Disable telemetry                                                                    [boolean]
  -v, -v, --version     Prints the latest version of the codemod                                             [boolean]
      --esm             Use to specify that you intend to use ESM-specific features in your codemods.
                                                                                            [boolean] [default: false]
  -j, --json            Respond with JSON                                                   [boolean] [default: false]
      --no-cache        Disable cache for HTTP(S) requests                                                   [boolean]
  -i, --include         Glob pattern(s) for files to include                                                   [array]
  -e, --exclude         Glob pattern(s) for files to exclude
               [array] [default: node_modules, .next, dist, build, *.d.ts, version control folders, gitignore entries]
  -t, --target          Input directory path                                                                  [string]
  -s, --source          Source path of the local codemod to run                                               [string]
      --engine          Engine to be used with standalone codemod. Can be used to skip the prompt.
                            [string] [choices: "jscodeshift", "recipe", "ts-morph", "filemod", "ast-grep", "workflow"]
      --logs            Print codemod execution errors into a logfile                       [boolean] [default: false]
      --format                                                                              [boolean] [default: false]
  -n, --threads         Number of worker threads                                                 [number] [default: 4]
  -d, --dry             Perform a dry run                                                   [boolean] [default: false]
  -m, --mode            Output mode to run the codemod in:
                        - json: Disables any stdout and only prints out JSON output
                         if a codemod returns any.                       [string] [choices: "json", "plain", "silent"]
      --no-install      Disable packages installation for the codemod run if there is `deps` field declared in its con
                        figuration                                                                           [boolean]
      --readme          Prints description/readme of the codemod if available in the configuration           [boolean]
      --config          Prints configuration file of the codemod                                             [boolean]
      --cloud           Run codemod in the cloud                                            [boolean] [default: false]
      --no-interactive  Disable interactive mode                                                             [boolean]

[Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable]
Error: Command failed: pnpx codemod@latest react/19/migration-recipe --no-interactive
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:888:11)
    at execSync (node:child_process:960:15)
    at runUpgrade (/home/user/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/bin/upgrade.js:256:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Command.<anonymous> (/home/user/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/bin/next-codemod.js:51:9) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1491,
  stdout: null,
  stderr: null
}

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024
  Available memory (MB): 9950
  Available CPU cores: 12
Binaries:
  Node: 22.10.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.12.2
Relevant Packages:
  next: 14.2.15 // Latest available version is detected (14.2.15).
  eslint-config-next: 14.2.15
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.3
Next.js Config:
  output: export


### Which area(s) are affected? (Select all that apply)

Not sure

### Which stage(s) are affected? (Select all that apply)

Other (Deployed)

### Additional context

_No response_
harrybawsac commented 3 weeks ago

I have the same problem running the command npx @next/codemod@canary upgrade latest. On yarn v1.22.22.

EDIT: I updated to yarn 4.5.1 and now it works.