Support Nuxt (Vite framework for Vue)
What version of Bun is running?
0.7.0
What platform is your computer?
Darwin 22.5.0 arm64 arm
What steps can reproduce the bug?
bun x nuxi@latest init my-nuxt-app- select
bunas package manager cd my-nuxt-appbun --bun run dev
What is the expected behavior?
➜ bun --bun run dev
Nuxi 3.6.5 10:06:22 PM
Nuxt 3.6.5 with Nitro 2.5.2 10:06:22 PM
[get-port] Unable to find an available port (tried 3000). Using alternative port: 3001 10:06:23 PM
10:06:23 PM
> Local: http://localhost:3001/
> Network: http://192.168.0.115:3001/
> Network: http://[2a02:a317:e440:2c80:1463:d84f:69c5:ac27]:3001/
> Network: http://[2a02:a317:e440:2c80:6c04:d94d:e2fb:8671]:3001/
✔ Nuxt Devtools is enabled v0.7.1 (experimental) 10:06:23 PM
ℹ Vite client warmed up in 591ms 10:06:24 PM
✔ Nitro built in 249 ms
What do you see instead?
➜ bun --bun run dev
$ nuxt dev
223 | throw err;
224 | return ret.stdout;
225 | }
226 | function fork() {
227 |
228 | throw new Error("Not implemented");
^
error: Not implemented
at fork (node:child_process:228:8)
at start (/Users/admin/repos/my-nuxt/node_modules/nuxi/dist/cli-wrapper.mjs:27:16)
at startSubprocess (/Users/admin/repos/my-nuxt/node_modules/nuxi/dist/cli-wrapper.mjs:23:2)
at /Users/admin/repos/my-nuxt/node_modules/nuxi/dist/cli-wrapper.mjs:7:2
error: script "dev" exited with code 1 (SIGHUP)
Additional information
Related:
- #3793
- https://github.com/oven-sh/bun/issues/3760
- https://github.com/oven-sh/bun/pull/4090
- #4098
- https://github.com/oven-sh/bun/pull/4208
- https://github.com/oven-sh/bun/issues/1519
Breaking because child_process.fork() isn't implemented yet
- https://github.com/oven-sh/bun/issues/3620
- #3851
Tested the latest release (v0.7.1) in a couple of my Nuxt projects by running bun --bun run dev and I can confirm that Nuxt is working now (at least for me). So cool! 🎉
Also tested bun --bun run build, bun --bun run generate, and bun --bun run preview without issues.
Awesome, thank you for sharing your findings! Closed by #3851
At least in some environments, the Nitro issue with formatWithOptions still appear to be breaking the repro detailed above:
➜ bun --bun run dev
$ nuxt dev
SyntaxError: Import named 'formatWithOptions' not found in module 'node:util'.
@danielwaltz , I'm a bit puzzled why this worked for you. Which architecture/os did you use?
@birkskyum I am on an apple silicon mac (arm64). I'm using the latest non-preview version of macOS (13.4.1 Ventura). For bun, I was using 0.7.1 at time of posting, but I also just now tried with the latest version (0.7.2) and it is still working for me.
What I suspect could be the case is the project you are referencing is using Nuxt features (like server endpoints or something else) that my smaller projects are not. Because Nuxt is dynamic about its dependencies and what is loaded at runtime based on what is used, my simple projects (both are personal/portfolio sites and one doesn't even use a router) probably have a smaller surface area of required features.
I wish I had a larger Nuxt project to test with! If you want to verify that Nuxt can run, feel free to clone my personal site and run bun i and bun --bun run dev. It should work!
EDIT: Also, I think it is worth noting that while Nuxt 3 is by default using Vite behind the scenes, it does still support webpack usage. I would also verify that the project you're using is not configured to use webpack instead just in case!
I just followed the reproduction steps, but i think you're right the use of a server makes the difference, because the error i get is related to Nitro
I have quite large NuxtJS project.
bun version: 0.7.3 architecture: MacOS M1
bun --bun run dev or bun --bun run generate throws this error:
[0.02ms] ".env"
24 | if (arg && typeof arg.stack === "string") {
25 | return arg.message + "\n" + this.formatStack(arg.stack, opts);
26 | }
27 | return arg;
28 | });
29 | return node_util.formatWithOptions(opts, ..._args);
^
TypeError: node_util.formatWithOptions is not a function. (In 'node_util.formatWithOptions(opts, ..._args)', 'node_util.formatWithOptions' is undefined)
at formatArgs (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/shared/consola.deac7d5a.cjs:29:11)
at formatLogObj (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/shared/consola.4bbae468.cjs:569:37)
at log (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/shared/consola.deac7d5a.cjs:53:17)
at _log (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/core.cjs:383:6)
at resolveLog (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/core.cjs:351:8)
at _logFn (/Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/consola/dist/core.cjs:379:4)
at /Users/pushupek/Praca/FrameLogic/src/gps-web/node_modules/nuxt/bin/nuxt.js:8:4
error: script "dev" exited with code 1 (SIGHUP)
@PushUpek , it's caused by this
- #3793
Getting somewhere...
Blockers
node:zlib'sbrotliCompressdoes not exist- wherever that spread is
- Is there supposed to be a stacktrace on this?
Getting somewhere...
Blockers
- ???, the process exits on the first request.
it does seem like the server can stay open now, but build gives:
➜ bun --bun run build
$ nuxt build
[10:08:34 AM] Nuxi 3.6.5
[10:08:34 AM] WARN Changing NODE_ENV from development to production, to avoid unintended behavior.
[10:08:34 AM] Nuxt 3.6.5 with Nitro 2.5.2
[10:08:35 AM] ℹ Building client...
[10:08:35 AM] ℹ vite v4.3.9 building for development...
[10:08:36 AM] ℹ ✓ 97 modules transformed.
[10:08:36 AM] ℹ .nuxt/dist/client/manifest.json 1.59 kB │ gzip: 0.32 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-dev.00ee2d03.css 2.26 kB │ gzip: 0.81 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-404.1da70a4c.css 3.66 kB │ gzip: 1.14 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/entry.9ed27021.css 12.44 kB │ gzip: 2.48 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-dev.4413317b.js 2.41 kB │ gzip: 1.24 kB │ map: 4.53 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-404.e8b9af35.js 6.90 kB │ gzip: 3.12 kB │ map: 24.41 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/entry.1866d780.js 225.83 kB │ gzip: 66.69 kB │ map: 857.85 kB
[10:08:36 AM] ℹ ✓ built in 1.39s
[10:08:36 AM] ✔ Client built in 1392ms
[10:08:36 AM] ℹ Building server...
[10:08:36 AM] ℹ vite v4.3.9 building SSR bundle for development...
[10:08:37 AM] ℹ ✓ 42 modules transformed.
[10:08:37 AM] ℹ .nuxt/dist/server/styles.mjs 0.07 kB
[10:08:37 AM] ℹ .nuxt/dist/server/_nuxt/island-renderer-f70c2cce.js 1.05 kB │ map: 1.41 kB
[10:08:37 AM] ℹ .nuxt/dist/server/_nuxt/error-dev-c6a413fd.js 3.52 kB │ map: 4.60 kB
[10:08:37 AM] ℹ .nuxt/dist/server/_nuxt/error-404-2bdc838f.js 10.23 kB │ map: 19.12 kB
[10:08:37 AM] ℹ .nuxt/dist/server/server.mjs 122.99 kB │ map: 165.13 kB
[10:08:37 AM] ℹ ✓ built in 359ms
[10:08:37 AM] ✔ Server built in 366ms
[10:08:37 AM] ERROR { columns: 47, date: true, colors: false, compact: true } { [SystemError] syscall: 'TODO', errno: -126 }
progress on build:
- fixed that syscall todo you have there
- identified the rollup parse error bug. probably going to submit a patch to nitropack
- Now blocked by #1519
havent taken a look fully at why the process dies on first request
I would like to report that using Nuxt with Nuxt Content module enabled will cause Nuxt failed to start. I was using bun install and bun --bun run dev in a repository using pnpm. I found it was @nuxt/content the cause of error by disabling all modules in nuxt.config.ts and then adding them back one after another.
Error message
Nuxi 3.6.5 11:23:20 AM
Nuxt 3.6.5 with Nitro 2.6.0 11:23:20 AM
11:23:21 AM
> Listening: http://localhost:3000/
ℹ Using default Tailwind CSS file nuxt:tailwindcss 11:23:21 AM
ERROR Cannot start nuxt: {} 11:23:21 AM
Environment
sw_vers output:
ProductName: macOS
ProductVersion: 13.4.1
ProductVersionExtra: (c)
BuildVersion: 22F770820d
bun nuxi info output:
- Operating System: `Darwin`
- Node Version: `v18.16.1`
- Nuxt Version: `3.6.5`
- Nitro Version: `2.5.2`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `css`, `devtools`, `modules`, `imports`, `pinia`, `postcss`, `gtm`, `security`, `runtimeConfig`
- Runtime Modules: `@nuxtjs/[email protected]`, `@pinia/[email protected]`, `@nuxt/[email protected]`, `@vueuse/[email protected]`, `[email protected]`, `[email protected]`, `@zadigetvoltaire/[email protected]`, `@nuxt/[email protected]`
- Build Modules: `-`
@toto6038 , can you make a small reproduction of this?
build and generate works now with latest canary.
There is a single issue left, that impact both preview and bun --bun x nuxi@latest init my-nuxt-app, which is:
- For creation of repo (
bun --bun x nuxi@latest init my-nuxt-app, select install withbun)
ERROR Error: Command failed: bun install
The first argument must be a Readable, a ReadableStream, or an async iterable.
- For
bun --bun run preview
ERROR Command failed: npx serve ./public
The first argument must be a Readable, a ReadableStream, or an async iterable.
error: script "preview" exited with code 1 (SIGHUP)
@birkskyum Sorry for late reply since I was on vacation. Please refer to the minimal reproduction. To see the output from console, you may need to fork the Repl and run it with Run button.
Testing my project on Nuxt 2 and it doesn't run. I get TypeError: undefined is not an object (evaluating 'e.columns') from the consola package version 2.15.3.
Repro for the issue mentioned by @giorgiopogliani - with consola 2.x, and thus Nuxt 2 as well:
bun add [email protected]
const consola = require('consola')
consola.success('Built!')
consola.info('Reporter: Some info')
consola.error(new Error('Foo'))
Each of these three lines gives the error:
➜ bun index.ts
178 | return t.writeSync(D.fd, u);
179 | default:
180 | return r.call(D, u);
181 | }
182 |
183 | }(this.formatLogObj(u, { width: e.columns || 0 }) + "\n", u.level < 2 ? r : e, D ? "async" : "default");
TypeError: undefined is not an object (evaluating 'e.columns')
at log (/Users/admin/repos/bun-kitchensink/node_modules/consola/dist/consola.js:1:43104)
at _log (/Users/admin/repos/bun-kitchensink/node_modules/consola/dist/consola.js:1:35096)
@giorgiopogliani , nuxt 2 have "consola": "3.2.3" (package.json) - are you on the latest nuxt 2.x?
I had similar problem like @giorgiopogliani. It seems like pinning concola version to 3.2.3 fix this issue. However, on my product project, i saw this error while building server part. I'm not sure what causes this error:
...
ERROR Could not fetch loading indicator: three-bounce
....
ERROR in ./components/common/bars/TestComponent.vue?vue&type=template&id=641fddae&
Module build failed (from ./node_modules/vuetify-loader/lib/loader.js):
TypeError: undefined is not an object (evaluating 'Object.keys(module.constructor._pathCache)')
at keys (native)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/decache/decache.js:40:17)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/matcher/generator.js:45:1)
at forEach (:1:11)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/matcher/generator.js:26:21)
at global code (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/matcher/generator.js:43:8)
at anonymous (native)
at require (:1:11)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/matcher/tag.js:2:38)
at global code (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/matcher/tag.js:9:8)
at anonymous (native)
at require (:1:11)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/loader.js:5:6)
at global code (/home/tuan3w/workspace/project/node_modules/vuetify-loader/lib/loader.js:119:8)
at anonymous (native)
at require (:1:11)
at loadLoader (/home/tuan3w/workspace/project/node_modules/webpack/node_modules/loader-runner/lib/loadLoader.js:18:4)
at iteratePitchingLoaders (/home/tuan3w/workspace/project/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:169:5)
at runLoaders (/home/tuan3w/workspace/project/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:365:5)
at doBuild (/home/tuan3w/workspace/project/node_modules/webpack/lib/NormalModule.js:296:4)
at buildModule (/home/tuan3w/workspace/project/node_modules/webpack/lib/Compilation.js:744:26)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/webpack/lib/Compilation.js:986:14)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/webpack/lib/NormalModuleFactory.js:409:5)
at anonymous (:5:10)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/webpack/lib/NormalModuleFactory.js:138:9)
at <anonymous> (/home/tuan3w/workspace/project/node_modules/webpack/lib/NormalModuleFactory.js:346:9)
at processTicksAndRejections (:1:1302)
@ ./components/common/bars/TestComponent.vue 1:0-88 11:2-8 12:2-17
@ ./.nuxt/components/index.js
@ ./.nuxt/components/plugin.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js
@birkskyum I am on Nuxt 2.15 because I have to stay on Vue 2.6
I am also not able to run a Nuxt 3 app using bun 1.0.0. I tested on macOS 13.5.2 (22G91) with Apple M1 Max chip.
I get a generic message about not being able to start nuxt when I run bun --bun run dev:
Nuxi 3.6.5
Nuxt 3.6.5 with Nitro 2.6.3
> Listening: http://localhost:3000/
ℹ Using default Tailwind CSS file nuxt:tailwindcss
ERROR Cannot start nuxt: {}
And I get the following error when I run bun --bun run build:
$ nuxt build
Nuxi 3.6.5
WARN Changing NODE_ENV from development to production, to avoid unintended behavior.
Nuxt 3.6.5 with Nitro 2.6.3
ℹ Using default Tailwind CSS file nuxt:tailwindcss
ERROR { columns: 157, date: true, colors: false, compact: true } {}
error: script "build" exited with code 1 (SIGHUP)
It's for a fairly simple static website(repo) with very few devDependencies and no dependencies:
"devDependencies": {
"@nuxt/content": "^2.7.2",
"@nuxt/image-edge": "^1.0.0-rc.1-28180077.d51e794",
"@nuxtjs/color-mode": "^3.3.0",
"@nuxtjs/tailwindcss": "^6.8.0",
"@tailwindcss/typography": "^0.5.8",
"nuxt": "3.6.5"
}
Followed the official guide, but \gGot this error today. bun run dev works, but bun --bun run dev does not.
I'm using Apple Silicon.
Followed the official guide, but \gGot this error today.
bun run devworks, butbun --bun run devdoes not.
I think that's because nuxt runs the dev server with Node by default and the issue is with bun runtime here.
Got the Cannot start nuxt: undefined is not an object (evaluating 'e.columns') with bun --bun run dev.
In my case, it's caused by nuxt-purgecss module. Disable it make my environment work.
modules: [
// 'nuxt-purgecss',
['@funken-studio/sitemap-nuxt-3', { generateOnBuild: true }],
'nuxt-security',
'@pinia/nuxt',
],
Hi, does Bun 1.0.0 working with Nuxt 2 ?
I've tried today and have the TypeError: undefined is not an object (evaluating 'e.columns') error, any clue ?
Thanks
@sbstnplcn, @Illuday , it's this consola issue that hasn't been resolved yet. If you are able to update to a newer next 2.x or nuxt 3.x that should do it.
@birkskyum thanks for your answer, I'm already running the last Nuxt v2.17.1 version and can't move to 3.x for now, I will wait until Nuxt release a new v2.x version with this resolved issue.
@sbstnplcn, @Illuday , it's this consola issue that hasn't been resolved yet. If you are able to update to a newer next 2.x or nuxt 3.x that should do it.
Got the error on nuxt 3.7.1, the problem for me is nuxt-purgecss!