vitejs / vite

Next generation frontend tooling. It's fast!
http://vitejs.dev
MIT License
67.2k stars 6.04k forks source link

issue with npm run dev, "[ERROR] Must use "outdir" when there are multiple input files" #17976

Open JWHu1-cmyk opened 2 weeks ago

JWHu1-cmyk commented 2 weeks ago

Describe the bug

Hi, I have followed the get started tutorial of vite. But I could not access the tutorial web page due to the following error

[ERROR] Must use "outdir" when there are multiple input files.

actually I seem to have found out the reason.

if I run the file in "/Users/ /Documents/- local files - programming env /* - folder, progring projects - test folder/testingArea-hu’s test" I get error.

but if I instead run it in "/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-hu’s test" all things work out.

but why? why does "*" matter.

Reproduction

https://stackblitz.com/edit/vitejs-vite-mnofsr?terminal=dev

Steps to reproduce

npm run dev

System Info

System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 83.63 MB / 16.00 GB
    Shell: 5.2.2 - /opt/homebrew/bin/bash
  Binaries:
    Node: 21.7.2 - /opt/homebrew/bin/node
    npm: 10.8.1 - /opt/homebrew/bin/npm
    pnpm: 9.9.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 128.0.6613.85
    Edge: 128.0.2739.42
    Safari: 17.2.1

Used Package Manager

npm

Logs

failed to load config from /Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/vite.config.js error when starting dev server: Error: Build failed with 1 error: error: Must use "outdir" when there are multiple input files at failureErrorWithLog (/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:1472:15) at /Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:945:25 at runOnEndCallbacks (/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:1315:45) at buildResponseToResult (/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:943:7) at /Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:970:16 at responseCallbacks. (/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:622:9) at handleIncomingPacket (/Users/ /Documents/- local files - programming env / - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:677:12) at Socket.readFromStdout (/Users/ /Documents/- local files - programming env /* - folder, progring projects - test folder/testingArea-vite, react, django, postgrep/vite-project/node_modules/esbuild/lib/main.js:600:7) at Socket.emit (node:events:519:28) at addChunk (node:internal/streams/readable:559:12)

Validations

stackblitz[bot] commented 2 weeks ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

iuuukhueeee commented 2 weeks ago

The reproduce you gave seems fine to me. Could you give more info?

bluwy commented 1 week ago

From https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names, * is forbidden in the file path. Perhaps that's why. It's better to stick with shorter and consistent directory names instead.

t-animal commented 1 week ago

I can confirm that this error occurs when a folder name in the curent path contains an asterisk (*). fwiw, this is perfectly legal in unix filenames, even though it may be confusing and didn't cause me any issues until now.