vercel / next.js

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

next codemod failed #64495

Open gengjiawen opened 5 months ago

gengjiawen commented 5 months ago

Link to the code that reproduces this issue

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web

To Reproduce

npx @next/codemod@latest metadata-to-viewport-export app

Current vs. Expected behavior

current:

 ERR app/config/server.ts Transformation error (Missing semicolon. (4:7))
SyntaxError: Missing semicolon. (4:7)
    at toParseError (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parse-error.ts:74:19)
    at JSXParserMixin.raise (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/tokenizer/index.ts:1487:19)
    at JSXParserMixin.semicolon (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/util.ts:141:10)
    at JSXParserMixin.parseExpressionStatement (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:1305:10)
    at JSXParserMixin.parseStatementContent (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:651:19)
    at JSXParserMixin.parseStatementLike (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:417:17)
    at JSXParserMixin.parseModuleItem (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:354:17)
    at JSXParserMixin.parseBlockOrModuleBlockBody (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:1385:16)
    at JSXParserMixin.parseBlockBody (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:1359:10)
    at JSXParserMixin.parseBlockBody (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/plugins/estree.ts:158:13)
    at JSXParserMixin.parseProgram (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:213:10)
    at JSXParserMixin.parseTopLevel (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/statement.ts:195:25)
    at JSXParserMixin.parse (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/parser/index.ts:45:10)
    at JSXParserMixin.parse (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/plugins/estree.ts:25:43)
    at Object.parse (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@babel/parser/src/index.ts:66:38)
    at Object.parse (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/jscodeshift/parser/babel5Compat.js:47:22)
    at Object.parse (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/recast/lib/parser.js:23:30)
    at fromSource (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/jscodeshift/src/core.js:82:25)
    at core (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/jscodeshift/src/core.js:44:5)
    at j (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/jscodeshift/src/core.js:142:12)
    at transformer (/home/gitpod/.npm/_npx/04c93779852ad6b7/node_modules/@next/codemod/transforms/metadata-to-viewport-export.js:5:18)

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #202402010024 SMP PREEMPT_DYNAMIC Thu Feb  1 01:44:23 UTC 2024
  Available memory (MB): 64299
  Available CPU cores: 16
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: 8.15.6
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: N/A
Next.js Config:
  output: standalone

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

Not sure

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

next dev (local)

Additional context

No response

gengjiawen commented 4 months ago

cc @huozhi