vite: Vite Version 6.0.4 is Not running in dev mode
Describe the bug
After installing new version of vite 6.0.4 vite is not working in dev mode but When i changed vite version to 5.0 its working.
Reproduction
npm create vite@latest
Steps to reproduce
npm run dev
System Info
node -v 18.20.5
npm 10.8.2
Ubuntu
Used Package Manager
npm
Logs
$ vite ✘ [ERROR] Expected identifier but found “import”
(define name):1:0:
1 │ import.meta.dirname
╵ ~~~~~~
✘ [ERROR] Expected identifier but found “import”
(define name):1:0:
1 │ import.meta.filename
╵ ~~~~~~
✘ [ERROR] Expected identifier but found “import”
(define name):1:0:
1 │ import.meta.url
╵ ~~~~~~
failed to load config from /home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/vite.config.js error when starting dev server: Error: Build failed with 3 errors: (define name):1:0: ERROR: Expected identifier but found “import” (define name):1:0: ERROR: Expected identifier but found “import” (define name):1:0: ERROR: Expected identifier but found “import” at failureErrorWithLog (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:1476:15) at /home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:945:25 at runOnEndCallbacks (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:1316:45) at buildResponseToResult (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:943:7) at /home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:970:16 at responseCallbacks.<computed> (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:622:9) at handleIncomingPacket (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:677:12) at Socket.readFromStdout (/home/abhishek/Workspace/Abhishek/DMS/dms-web-v2/node_modules/esbuild/lib/main.js:600:7) at Socket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:368:12) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 19
- Comments: 21 (2 by maintainers)
try
pnpm add esbuild@0.24.0 -D,it works for meI’m using
yarn. A quick and dirty solution is:cd node_modules/viterm -rf ./node_modulespackage.jsonand change"esbuild": "^0.24.0",to"esbuild": "0.24.0",yarn install(inside thenode_modules/vitefolder)I had the same issue and downgrading esbuild solved it.
I am confirming that I encountered the same issue just now.
Environment: NPM and Bun in Windows 11.
short term solution:
same issue here
Same issue here. I’ve tried 6.01, 6.02, and 6.04. I can confirm that the
npm i -D esbuild@0.24.0hot fix works for 6.04.5.4.11 is the latest version that works without it. I had been creating fresh projects and running builds all day. This just happened within the last few hours.
Sys info: node v20.9.0 npm v10.9.0 MacOS 15.1.1
I encountered the same issue with Vite version 6.0.4 not running in development mode. As a workaround, I downgraded to version
"vite": "^5.1.8", and the project ran successfully. It seems there may be compatibility issues with the latest version.