evanw / esbuild

An extremely fast bundler for the web
https://esbuild.github.io/
MIT License
37.98k stars 1.14k forks source link

esbuild tried to read "../../.." , in vite , using npm run dev #3783

Closed dragoon4890 closed 3 months ago

dragoon4890 commented 4 months ago

When running npm run dev in windows 11 powershell without admin priveldges , it shows the following error vite version 5.0.8

I have tried the same thing with git bash and cmd.

> part1@0.0.0 dev
> vite --base "./"

✘ [ERROR] Cannot read directory "../../..": Access is denied.

✘ [ERROR] Could not resolve "C:\\Users\\Harsh\\Desktop\\website\\website\\vite.config.js"

failed to load config from C:\Users\Harsh\Desktop\website\website\vite.config.js
error when starting dev server:
Error: Build failed with 2 errors:
error: Cannot read directory "../../..": Access is denied.
error: Could not resolve "C:\\Users\\Harsh\\Desktop\\website\\website\\vite.config.js"
    at failureErrorWithLog (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:1651:15)
    at C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:1059:25
    at runOnEndCallbacks (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:1486:45)
    at buildResponseToResult (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:1057:7)
    at C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:1086:16
    at responseCallbacks.<computed> (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:704:9)
    at handleIncomingPacket (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:764:9)
    at Socket.readFromStdout (C:\Users\Harsh\Desktop\website\website\node_modules\esbuild\lib\main.js:680:7)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)

note that i added --base "./" to make it the root directory , even before it didnt work.

here's my vite.config.js

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  base: '/',
});

Also npm run dev works if i give it admin priveldges or if i use older versions of vite like 2.5

Something similar in https://github.com/evanw/esbuild/issues/2261 but didnt help

evanw commented 3 months ago

Can you provide a way to reproduce your issue? Otherwise I'm not going to be able to do anything about this. Marking as unactionable for now. Note that I need all specific instructions and/or source code required to reproduce the problem, not just a config file. I don't use Vite myself and don't know how it works.

evanw commented 3 months ago

Closing because there was no reply.