Next.js Discord

Discord Forum

Invalid or unexpected token

Unanswered
Mini Rex posted this in #help-forum
Open in Discord
Mini RexOP
SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (C:\Users\Visu\Desktop\Visual Studio Workspaces\EmreNext\emrenex\node_modules\next\dist\server\require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (C:\Users\Visu\Desktop\Visual Studio Workspaces\EmreNext\emrenex\node_modules\styled-jsx\index.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)

9 Replies

Mini RexOP
This is directly from the latest create-next-app project. I just tried to yarn run dev it
{
  "name": "example",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "13.5.1",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}
and here is my package json
Mini RexOP
Bump please
European sprat
Node version?
@European sprat Node version?
Mini RexOP
LTS
18.18.0
send next info
Northeast Congo Lion
I have the same issue with multiple versions of Next (14.0.5-canary.9, 14.0.4, 14.0.4-canary.45, 13.4.8). My error comes from PayloadCMS's package:

Collecting page data  .../home/7alarz/dev/solo/art-agenda-pl/node_modules/payload/dist/admin/components/elements/Tooltip/index.scss:1
@import '../../../scss/styles.scss';
^

SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at mod.require (/home/7alarz/dev/solo/art-agenda-pl/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/7alarz/dev/solo/art-agenda-pl/node_modules/payload/dist/admin/components/elements/Tooltip/index.js:13:1)

> Build error occurred
Error: Failed to collect page data for /
    at /home/7alarz/dev/solo/art-agenda-pl/node_modules/next/dist/build/utils.js:1236:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}


And here is my next info

Operating System:
  Platform: linux
  Arch: x64
  Version: #202310061235~1697396945~22.04~9283e32 SMP PREEMPT_DYNAMIC Sun O
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.0.4
  eslint-config-next: 13.1.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 4.9.5
Next.js Config:
  output: N/A