Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm run dev not working with vite laravel 9

users-iMac-2:backend NEHAL$ npm run dev

> dev
> vite

file:///Users/user/Desktop/backend/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:122:18)
    at async link (internal/modules/esm/module_job.js:42:21)
users-iMac-2:backend NEHAL$ 
like image 963
Nehal Ahmed Khan Avatar asked Sep 05 '25 03:09

Nehal Ahmed Khan


2 Answers

Same problem. Updated node to v16.16.0 and it worked.

like image 168
gs101 Avatar answered Sep 08 '25 00:09

gs101


The installed version of NodeJS on your OS is incompatible with vite. Update the installed version (mine was v12.22.9).

If you're using a debian-based OS, run the following.

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
like image 30
X 47 48 - IR Avatar answered Sep 07 '25 23:09

X 47 48 - IR