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

Fails to run certain Vite frameworks scaffolded with create-vite #6482

Open
justDeeevin opened this issue Oct 13, 2023 · 12 comments
Open

Fails to run certain Vite frameworks scaffolded with create-vite #6482

justDeeevin opened this issue Oct 13, 2023 · 12 comments
Labels
bug Something isn't working npm Something that relates to the npm-compatible client

Comments

@justDeeevin
Copy link

justDeeevin commented Oct 13, 2023

What version of Bun is running?

1.0.6+584e6dd1c2240fd1767b7a7280e4695965f71237

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

  1. Scaffold a Vite application using bun create vite and select any of the following frameworks:
    • React
    • Svelte
    • Solid
    • Vue
  2. cd into the new project and install the dependencies with bun i or npm i
  3. Attempt to run the development server with bun using bun run --bun dev

What is the expected behavior?

Bun should start a Vite development server

What do you see instead?

For React, SvelteKit, and Solid:
image
SvelteKit also has a warning, but it isn't fatal.

For Vue:
image

Additional information

This was previously pointed out in #5100, but the team found a bug that they thought was causing the issue and updated the issue to be for that bug. However, that bug seemingly wasn't the only cause for the issue, so I'm bringing it up again here.

And, just for posterity, this is a Bun-specific issue. None of this occurs with bun run dev (where Node is used instead of Bun)

@justDeeevin justDeeevin added the bug Something isn't working label Oct 13, 2023
@justDeeevin justDeeevin changed the title Fails to run certain Vite frameworks (including React and SvelteKit) created with bun create Fails to run certain Vite frameworks created with bun create Oct 13, 2023
@justDeeevin justDeeevin changed the title Fails to run certain Vite frameworks created with bun create Fails to run certain Vite frameworks scaffolded with create-vite Oct 13, 2023
@Electroid Electroid added the npm Something that relates to the npm-compatible client label Oct 13, 2023
@Electroid
Copy link
Contributor

This is potentially a bug with bun install not adding the right dependencies.

@Denis6902
Copy link

This is potentially a bug with bun install not adding the right dependencies.

I have same error when I use bunx --bun vite instead bunx vite .
I tried use npm install instead bun install and it did not help.

@lc-guy
Copy link

lc-guy commented Oct 15, 2023

also getting this issue in wsl with a small sveltekit app, npm install doesn't fix it

@justDeeevin
Copy link
Author

Potentially a WSL issue?

@Denis6902
Copy link

Potentially a WSL issue?

I have this problem on MacOS

@paperdave
Copy link
Collaborator

to verify this is not a duplicate of the other issue, does this reproduce if you do not use a space in the directory Software Dev? that was the main thing causing the other bug. it may be a second case where we do not consider special characters in paths.

@lc-guy
Copy link

lc-guy commented Oct 17, 2023

to verify this is not a duplicate of the other issue, does this reproduce if you do not use a space in the directory Software Dev? that was the main thing causing the other bug. it may be a second case where we do not consider special characters in paths.

I don't have any spaces in my path to the build/ folder and this error still occurs.

@Denis6902
Copy link

to verify this is not a duplicate of the other issue, does this reproduce if you do not use a space in the directory Software Dev? that was the main thing causing the other bug. it may be a second case where we do not consider special characters in paths.

With the latest version of Bun and Vite in a folder without special characters and space bunx --bun vite now works.

But bunx --bun vite build do not work.

error during build:
Error: Unable to write the service worker file. ''
at (/.../node_modules/workbox-build/build/lib/write-sw-using-default-template.js:67:81)
at processTicksAndRejections (:61:77)

Bun version: 1.0.7+b0393fba6200d8573f3433fb0af258a0e33ac157
Vite version: 4.5.0

Probably same problem #6302

@lukaselmer
Copy link

lukaselmer commented Oct 23, 2023

I get a different error running bunx --bun vite:

❯ bun vite --version
vite/4.5.0 darwin-arm64 node-v20.8.0
❯ bun --version
1.0.7
❯ bunx --bun vite
file:///example/node_modules/vite/dist/node/cli.js:442
          throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
                ^

CACError: Unknown option `--bun`
    at Command.checkUnknownOptions (file:///example/node_modules/vite/dist/node/cli.js:442:17)
    at CAC.runMatchedCommand (file:///example/node_modules/vite/dist/node/cli.js:640:13)
    at CAC.parse (file:///example/node_modules/vite/dist/node/cli.js:579:12)
    at file:///example/node_modules/vite/dist/node/cli.js:926:5
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)

Node.js v20.8.0

Does anyone know how to fix this?

@notramo
Copy link

notramo commented Dec 16, 2023

This seems to be fixed since.

@lukaselmer
Copy link

bunx --bun vite

I don't think so. Upgraded bun and vite, and still getting the same error. At least not on my machine? 🤔

Does anyone know how to fix this?

❯ bunx --bun vite
file:///private/tmp/vite@latest--bunx/node_modules/vite/dist/node/cli.js:444
          throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
                ^

CACError: Unknown option `--bun`
    at Command.checkUnknownOptions (file:///private/tmp/vite@latest--bunx/node_modules/vite/dist/node/cli.js:444:17)
    at CAC.runMatchedCommand (file:///private/tmp/vite@latest--bunx/node_modules/vite/dist/node/cli.js:642:13)
    at CAC.parse (file:///private/tmp/vite@latest--bunx/node_modules/vite/dist/node/cli.js:581:12)
    at file:///private/tmp/vite@latest--bunx/node_modules/vite/dist/node/cli.js:927:5
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)

Node.js v20.5.1
❯ cat /private/tmp/vite@latest--bunx/node_modules/vite/package.json | grep version
  "version": "5.0.10",
❯ bun --version
1.0.18
image

@notramo
Copy link

notramo commented Dec 16, 2023

@lukaselmer bunx is for running executables from packages that are not installed in the current project. If it's in the dependencies list (I assume Vite is in there.), you can start it with bun --bun run vite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working npm Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

7 participants