How to use Quasar Framework and/or Vue3 with Bun.js
Asked Answered
S

3

6

Using the bun create [..] command, I could create a react and a next project. It was straightforward following the instructions on the bun git repository (update: most instructions can be found at bun.sh).

But I could not get it to work with quasar/vue.

I could successfully install quasar with bun:

bun install -g @quasar/cli

But when I tried to create a quasar project:

quasar create [..]

I get a message like:

  • /usr/bin/env: ‘node’: Permission denied
  • /usr/bin/env: ‘node’: No such file or directory

It looks like quasar is trying to use the node executable instead of bun.

Any ideas how can I make it works with quasar/vue?

Supat answered 23/7, 2022 at 4:24 Comment(0)
C
1

The problem is that Bun.js is still missing a few packages like readline. See also here https://github.com/oven-sh/bun/issues/311.

bun --bun run quasar

Runs quite well and gives an output.

bun --bun run quasar build

Gives you the following error message.

error: Cannot find package "readline" from "/home/<user>/<project>/node_modules/@quasar/app-vite/lib/helpers/logger.js"
error: "quasar" exited with code 1 (SIGHUP)

I think we still have to wait for a stable v1.0.

Update 18.01.2023

With Bun v0.5.0 we are getting a little closer to the goal. Unfortunately the worker_threads support is still missing and therefore quasar build still fails.

quasar build output

Conant answered 27/12, 2022 at 20:53 Comment(1)
bun --bun run quasar <cmd> is what I was looking for! worked for me on bun 1.0.3 and @quasar/app-vite 1.6.2, specifically tried with quasar commads add mode bex and describe QIconAid
R
1

There is an opened discussion on the Quasar repo, also Razvan Stoenescu, the creator of Quasar, opened a bug for this topic so we can expect tested support in some months

Update

As replied by Razvan Stoenescu

Will be available in q/app-vite v1.6 & q/app-webpack v3.11 (backported from the next major version of the CLIs -- unreleased yet)

Update 2

Since CLI v2.3.0 Quasar supports Bun as package manager: https://github.com/quasarframework/quasar/releases/tag/%40quasar%2Fcli-v2.3.0

Romaic answered 12/9, 2023 at 9:37 Comment(0)
A
0

Using bun 1.0.3 on a system without node installed, the following works to create a quasar project:

bun install -g @quasar/cli && bun create quasar

And you should be able to run quasar without node if you prefix it with bun run:

bun run quasar build

If you have a version of node installed and want to avoid using it, you MUST use the --bun flag to force the usage of bun instead of node:

bun create --bun quasar
bun run --bun quasar build

On machines without node installed --bun seems to be the default behavior.

Create an alias or function in your shell's .rc file:

function quasar() {
  # option A - "do not use node under any circumstances":
  # bun run --bun quasar "${@}"
  # option B - "node is fine to use when I have it"
  bun run quasar "${@}"
}

Then either restart your shell or source it:

# bash
source ~/.bashrc
# zsh
source ~/.zshrc
# etc...

now you can run quasar's cli with bun as you would normally:

quasar build

There may still be some commands that do not work correctly, see the compatibility tracker.

from the quasar side, @quasar/cli-v2.30, @quasar/app-webpack-v3.11.0, and @quasar/app-vite-v1.6.0 are listed as officially supporting bun!

Aid answered 23/9, 2023 at 15:3 Comment(3)
nah its just wrapping bun around node unless you use bun --bun see ps -a output... quasar is still running under node text 90029 ttys011 0:00.01 bun run dev 90030 ttys011 0:00.00 /bin/bash -c bun run lint:fix && bun run quasar dev 90033 ttys011 0:00.00 bun run quasar dev 90034 ttys011 0:00.69 node /Users/dan/test/node_modules/.bin/quasar dev Apiece
so, you sort of right. What's interesting about this is that I ran bun run quasar on a system that does not even have node installed, and when I ran bun create quasar and checked ps aux | grep '[n]ode', I saw the node process, however when I ran ls -l /proc/<pid>/exe I found out that it was actually just pointing back to my bun installation, the weirdest part is that bun --bun create quasar failed and bun create quasar did not. You're completely correct when there is a version of node installed though.Aid
update on the last comment, bun create --bun quasar works just fine without any node installation, so I guess bun <cmd> <args> is equivalent to bun <cmd> --bun <args> on machines that do not have node installed I have created an issue on their github for failure when --bun is before createAid

© 2022 - 2024 — McMap. All rights reserved.