next.js: next dev bug: ReferenceError: performance is not defined
Link to the code that reproduces this issue
https://github.com/ymrdf/nextjs-bug-report
To Reproduce
- fellow this tutorial(https://nextjs.org/learn/foundations/from-react-to-nextjs/getting-started-with-nextjs) to the step
Running the development server
and runnpm run dev
. or clonehttps://github.com/ymrdf/nextjs-bug-report
and runnpm run dev
2, you will get this error:
> next-test@1.0.0 dev /media/gao/1a0b122f-05c3-4067-8e69-4fc86ce7df23/work/test/next
> next dev
/media/gao/1a0b122f-05c3-4067-8e69-4fc86ce7df23/work/test/next/node_modules/next/dist/bin/next:57
performance.mark("next-start");
^
ReferenceError: performance is not defined
at Object.<anonymous> (/media/gao/1a0b122f-05c3-4067-8e69-4fc86ce7df23/work/test/next/node_modules/next/dist/bin/next:57:1)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! next-test@1.0.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the next-test@1.0.0 dev script.
Current vs. Expected behavior
expect to launch a nextjs dev server
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
running `npx --no-install next info` or `npx next info` will also produce this error `performance is not defined`
info:
next: 13.5.6
node: 14.21.3
npm:6.14.18
system: ubuntu 22.04.3 LTS
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 6
- Comments: 15 (1 by maintainers)
Hello! I was getting the same error and i think the problem was having an old version of node installed. I updated node to version 20.9.0 and it started working. You have v14.21.3, maybe you are having the same issue. Hope this helps
try the latest node
That update node can resolve this problem. They have said that nextjs depend on Node.js 18.17 or later on the document. I didn’t notice it!
Please use node v18, It works on it.