Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volar will fail to start preview server if .vite directory doesn't exist yet. #2223

Closed
segevfiner opened this issue Dec 18, 2022 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@segevfiner
Copy link
Contributor

node "/Users/segevfiner/.vscode/extensions/vue.volar-1.0.14-darwin-arm64/dist/preview-bin/vite.js" --port=3333
node:internal/fs/utils:347
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/Users/segevfiner/junk/volar-starter/node_modules/.vite/volar-vite.config.ts'
    at Object.openSync (node:fs:590:3)
    at Object.writeFileSync (node:fs:2202:35)
    at createViteConfig (/Users/segevfiner/.vscode/extensions/vue.volar-1.0.14-darwin-arm64/dist/preview-bin/vite.js:90:5)
    at Object.<anonymous> (/Users/segevfiner/.vscode/extensions/vue.volar-1.0.14-darwin-arm64/dist/preview-bin/vite.js:76:1)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/segevfiner/junk/volar-starter/node_modules/.vite/volar-vite.config.ts'
@johnsoncodehk johnsoncodehk added bug Something isn't working good first issue Good for newcomers labels Dec 18, 2022
@johnsoncodehk
Copy link
Member

We currently do not check this, a workaround is run npm run dev for vite project before the preview feature.
https://github.com/johnsoncodehk/volar/blob/087f0faac321b01575232b647675179954447408/packages/preview/bin/vite.js#L85-L93

@segevfiner
Copy link
Contributor Author

Yeah. That's what I did, still might want to stick an mkdir there, no?

@johnsoncodehk
Copy link
Member

Maybe automatically execute npm run dev for the project to build the .vite, or pop up a prompt asking the user to do so. 🤔(Not sure the best solution for now.)

@segevfiner
Copy link
Contributor Author

Why not just an mkdir? Do you actually need the contents of that directory or just a place to put volar-vite.config.ts?

@johnsoncodehk
Copy link
Member

Maybe you're right, I sort of forgot how that was done, will see later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants