Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Error message with "npm run dev" , while trying to set up react app?

When I run the npm command in the terminal to set up my react app. I am getting this error message in the terminal.

> grocery-list@0.0.0 dev 
C:\Users\Myko\Desktop\React_Practice
> vite

C:\Users\Desktop\React_Practice\node_modules\vite\bin\vite.js:2
import { performance } from 'node:perf_hooks'
       ^

SyntaxError: Unexpected token {
    at new Script (vm.js:83:7)
    at createScript (vm.js:267:10)
    at Object.runInThisContext (vm.js:319:10)
    at Module._compile (internal/modules/cjs/loader.js:685:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    at startup (internal/bootstrap/node.js:300:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grocery-list@0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grocery-list@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2024-02-19T08_03_15_600Z-debug.log

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hey Gremyko Coleman 👋

I'm unfamiliar with this issue but done some Googling and most answers suggest updating your Node.js version as Vite requires version 18 or higher.

Hope this helps! 🙂

Thank you, that worked