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

Support Nuxt (Vite framework for Vue) #3771

Open
birkskyum opened this issue Jul 23, 2023 · 50 comments
Open

Support Nuxt (Vite framework for Vue) #3771

birkskyum opened this issue Jul 23, 2023 · 50 comments
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@birkskyum
Copy link
Collaborator

birkskyum commented Jul 23, 2023

Nuxt.js GitHub - Website

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 bun as package manager
  • cd my-nuxt-app
  • bun --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:

@birkskyum birkskyum added the bug Something isn't working label Jul 23, 2023
@birkskyum birkskyum changed the title Support Nuxt Support Nuxt (Vite framework for Vue) Jul 23, 2023
@birkskyum
Copy link
Collaborator Author

birkskyum commented Jul 24, 2023

Breaking because child_process.fork() isn't implemented yet

@robobun robobun added the node.js Compatibility with Node.js APIs label Jul 24, 2023
@danielwaltz
Copy link

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.

@birkskyum
Copy link
Collaborator Author

Awesome, thank you for sharing your findings! Closed by #3851

@birkskyum birkskyum reopened this Jul 30, 2023
@birkskyum
Copy link
Collaborator Author

birkskyum commented Jul 30, 2023

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'.

@birkskyum
Copy link
Collaborator Author

@danielwaltz , I'm a bit puzzled why this worked for you. Which architecture/os did you use?

@danielwaltz
Copy link

danielwaltz commented Aug 5, 2023

@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!

@birkskyum
Copy link
Collaborator Author

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

@PushUpek
Copy link

PushUpek commented Aug 7, 2023

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)

@birkskyum
Copy link
Collaborator Author

birkskyum commented Aug 7, 2023

@PushUpek , it's caused by this

@paperdave
Copy link
Member

Getting somewhere...

image

Blockers

  • node:zlib's brotliCompress does not exist
  • wherever that spread is
  • Is there supposed to be a stacktrace on this?

@paperdave
Copy link
Member

Getting somewhere...

image

Blockers

  • ???, the process exits on the first request.

@birkskyum
Copy link
Collaborator Author

birkskyum commented Aug 18, 2023

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 kBgzip:  0.32 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-dev.00ee2d03.css    2.26 kBgzip:  0.81 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-404.1da70a4c.css    3.66 kBgzip:  1.14 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/entry.9ed27021.css       12.44 kBgzip:  2.48 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-dev.4413317b.js     2.41 kBgzip:  1.24 kBmap:   4.53 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/error-404.e8b9af35.js     6.90 kBgzip:  3.12 kBmap:  24.41 kB
[10:08:36 AM] ℹ .nuxt/dist/client/_nuxt/entry.1866d780.js       225.83 kBgzip: 66.69 kBmap: 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 kBmap:   1.41 kB
[10:08:37 AM] ℹ .nuxt/dist/server/_nuxt/error-dev-c6a413fd.js          3.52 kBmap:   4.60 kB
[10:08:37 AM] ℹ .nuxt/dist/server/_nuxt/error-404-2bdc838f.js         10.23 kBmap:  19.12 kB
[10:08:37 AM] ℹ .nuxt/dist/server/server.mjs                         122.99 kBmap: 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 }

@paperdave
Copy link
Member

progress on build:

havent taken a look fully at why the process dies on first request

@toto6038
Copy link

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:    `-`

@birkskyum
Copy link
Collaborator Author

@toto6038 , can you make a small reproduction of this?

@birkskyum
Copy link
Collaborator Author

birkskyum commented Aug 31, 2023

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 with bun)
 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)

@toto6038
Copy link

toto6038 commented Sep 4, 2023

@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.

@giorgiopogliani
Copy link

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.

@birkskyum
Copy link
Collaborator Author

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)

@birkskyum
Copy link
Collaborator Author

@giorgiopogliani , nuxt 2 have "consola": "3.2.3" (package.json) - are you on the latest nuxt 2.x?

@tuan3w
Copy link

tuan3w commented Sep 9, 2023

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

@giorgiopogliani
Copy link

@birkskyum I am on Nuxt 2.15 because I have to stay on Vue 2.6

@SubodhDahal
Copy link

SubodhDahal commented Sep 10, 2023

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"
  }

@leochoo
Copy link

leochoo commented Sep 11, 2023

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.

CleanShot 2023-09-11 at 19 10 34

@Giton22
Copy link

Giton22 commented Sep 11, 2023

Followed the official guide, but \gGot this error today. bun run dev works, but bun --bun run dev does not.

I think that's because nuxt runs the dev server with Node by default and the issue is with bun runtime here.

@Illuday
Copy link

Illuday commented Sep 11, 2023

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',
],

@sbstnplcn
Copy link

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

@birkskyum
Copy link
Collaborator Author

birkskyum commented Sep 11, 2023

@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.

@sbstnplcn
Copy link

@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.

@Illuday
Copy link

Illuday commented Sep 11, 2023

@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!

@leochoo
Copy link

leochoo commented Sep 11, 2023

Anyone solved / worked around this?

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.

CleanShot 2023-09-11 at 19 10 34

@ExEr7um
Copy link

ExEr7um commented Sep 11, 2023

Anyone solved / worked around this?

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.
CleanShot 2023-09-11 at 19 10 34

It could be because of %20 in path. Can you try to put your project in root of your user?

@Hebilicious
Copy link

Hebilicious commented Sep 11, 2023

Something that could be related that happens to me, when I run bun dev, ctrlc + C, bun dev, For some reasons the old dev server isn't correctly destroyed, and this opens a new one on the next port (3000, 3001, ...). Anyone else has this issue ?

@muffe
Copy link

muffe commented Sep 11, 2023

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:  {}                            

I get the exact same error with the @nuxtjs/supabase module.
As soon as I comment it out, the app starts fine.

Running Nuxt 3.7.1 on WSL 2 Ubuntu

@tuan3w
Copy link

tuan3w commented Sep 11, 2023

I tried to investigate more into the problem with nuxt 2 & consola. The reason why it doesn't work with consola 2 is that consola 2 is using console._stdout which isn't available in bun. Some libraries use consola v2 causing this problem. Force using consola 3.2.3 fixes this problem:

{
  "resolutions": {
     "consola": "3.2.3"
  }
}

However, I still can't build my code because this error #4591. I got these errors:

ERROR in ./node_modules/vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css (./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/postcss-loader/dist/cjs.js??ref--3-oneOf-1-2!./node_modules/vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: stacks.shift is not a function. (In 'stacks.shift()', 'stacks.shift' is undefined)

/home/tuan3w/workspace/XXX/node_modules/@nuxt/components/dist/loader.js??ref--0-0!/home/tuan3w/workspace/XXX/node_modules/vue-loader/lib/index.js??vue-loader-options!/home/tuan3w/workspace/XXX/components/analytics/chart/XXX.vue c9890deed0259bd97c156953285a51b6
An error occurred while decoding the string

@birkskyum
Copy link
Collaborator Author

birkskyum commented Sep 11, 2023

that one is similar to

@cosmith
Copy link

cosmith commented Sep 12, 2023

I'm having an issue with consola 2.15 too, because of https:/vbenjs/vite-plugin-html. Unfortunately we can't yet use overrides (#1134)

@rafaelfess
Copy link

rafaelfess commented Sep 13, 2023

Without NodeJS installed, bun x seems to not respect the --bun flag.

❯ bun --version
1.0.1

❯ bunx --bun nuxi@latest init my-app
/usr/bin/env: ‘node’: No such file or directory
error: "nuxi" exited with code 127

❯ bunx nuxi@latest init my-app
/usr/bin/env: ‘node’: No such file or directory
error: "nuxi" exited with code 127

I can't even initialize a Nuxt 3 app with only bun installed on the system.

These are the instructions from bun's release blog post.

As I understand it, bun should only use NodeJS by default if --bun is not passed as a flag, as noted in the documentation.

@birkskyum
Copy link
Collaborator Author

@tuan3w , can you can try upgrading to latest canary and build again? The "stacks.shift" issue should be resolved now

@tuan3w
Copy link

tuan3w commented Sep 20, 2023

Hi @birkskyum

Thanks for the update. After updating to the latest canary, I got this error while building:

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/VueProject/node_modules/vuetify-loader/node_modules/decache/decache.js:40:4)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/matcher/generator.js:45:1)
    at forEach (:1:21)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/matcher/generator.js:26:2)
    at global code (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/matcher/generator.js:43:8)
    at anonymous (native)
    at require (:1:21)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/matcher/tag.js:2:33)
    at global code (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/matcher/tag.js:9:8)
    at anonymous (native)
    at require (:1:21)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/loader.js:5:6)
    at global code (/home/tuan3w/workspace/VueProject/node_modules/vuetify-loader/lib/loader.js:119:8)
    at anonymous (native)
    at require (:1:21)
    at loadLoader (/home/tuan3w/workspace/VueProject/node_modules/webpack/node_modules/loader-runner/lib/loadLoader.js:18:4)
    at iteratePitchingLoaders (/home/tuan3w/workspace/VueProject/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/tuan3w/workspace/VueProject/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:365:2)
    at doBuild (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/NormalModule.js:295:3)
    at buildModule (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/Compilation.js:744:26)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/Compilation.js:986:10)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/NormalModuleFactory.js:409:5)
    at anonymous (:5:1)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/NormalModuleFactory.js:138:5)
    at <anonymous> (/home/tuan3w/workspace/VueProject/node_modules/webpack/lib/NormalModuleFactory.js:345:23)
    at processTicksAndRejections (:55:77)
 @ ./components/VerifyAccount.vue 1:0-92 10:2-8 11: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

ERROR in ./components/Component.vue?vue&type=template&id=e9cd33f6&

Extra information:

  • decache : 4.6.2
  • vue-loader: 15.10.1

@leochoo
Copy link

leochoo commented Sep 20, 2023

@ExEr7um

It could be because of %20 in path. Can you try to put your project in root of your user?
Thank you! Removing the space within the path to the project solved it! (I did not have to move it to root)

BUT... the app started by bun --bun run dev will hang..
-> Fixed it by upgrading to Bun v1.0.2! 😀

@cosmith
Copy link

cosmith commented Sep 21, 2023

Since #5842 was merged I tested with bun upgrade --canary. No more errors when building and running my vite app!

@birkskyum
Copy link
Collaborator Author

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 with bun)
 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)

Consola issues seem to be fixed now, but these errors still exist.

@romastolbov
Copy link

romastolbov commented Sep 21, 2023

There is a problem with @nuxt/content

"@nuxt/content": "^2.8.2",
"nuxt": "^3.7.3"

In my nuxt.config.ts:

  modules: [
    '@nuxt/content',
  ],

bun --bun run dev return ERROR Cannot start nuxt: {}

Снимок экрана 2023-09-21 в 11 56 05

@birkskyum
Copy link
Collaborator Author

birkskyum commented Dec 19, 2023

@romastolbov , do you see that on latest versions as well? I get this output with bun --bun run dev (bun 1.0.18)

➜ bun --bun run dev    
$ nuxt dev
Nuxt 3.8.2 with Nitro 2.8.1                                                            12:29:06 PM
                                                                                       12:29:07 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

  ➜ DevTools: press Shift + Option + D in the browser (v1.0.6)                         12:29:07 PM

ℹ Vite client warmed up in 179ms                                                      12:29:07 PM
ℹ Vite server warmed up in 638ms                                                      12:29:08 PM
✔ Nitro built in 251 ms  

@romastolbov
Copy link

@birkskyum its ok now

@cotneit
Copy link

cotneit commented Mar 18, 2024

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 with bun)
 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)

This is #7068

@kenneth-hendricks
Copy link

kenneth-hendricks commented Jun 9, 2024

Also seeing this same error when running bun nuxi typecheck on bun (1.1.12):

 ERROR  Command failed: /node_modules/vue-tsc/bin/vue-tsc.js --noEmit                                                                                                                                                                                
The first argument must be a Readable, a ReadableStream, or an async iterable.

@birkskyum
Copy link
Collaborator Author

birkskyum commented Jun 26, 2024

To summarize, with (1.1.17+bb66bba1b) these commands work:

  • bun --bun run dev
  • bun --bun run build
  • bun --bun run generate

And this one doesn't:

  • bun --bun run preview

Output from the preview command:

⇣5% ➜ bun --bun run preview
$ nuxt preview
                                                                   12:08:33 AM
 ╭────────────────────────────────────────Preview Mode──────────────────────────────────────────╮
 │                                                                                              │
 │  You are running Nuxt production build in preview mode.                                      │
 │  For production deployments, please directly use node ./server/index.mjs command.            │
 │                                                                                              │
 │  Node.js:           v22.3.0                                                                  │
 │  Nitro Preset:      node-server                                                              │
 │  Working directory: .output                                                                  │
 │                                                                                              │
 ╰──────────────────────────────────────────────────────────────────────────────────────────────╯

[12:08:33 AM] ℹ Loading .env. This will not be loaded when running the server in production.
ℹ Starting preview command: node ./server/index.mjs               12:08:33 AM
                                                                   12:08:33 AM

 ERROR  Command failed: node ./server/index.mjs                    12:08:33 AM
The first argument must be a Readable, a ReadableStream, or an async iterable.

  at <anonymous> (node_modules/nuxi/dist/chunks/index3.mjs:1817:13)
  at getStreamContents (node_modules/nuxi/dist/chunks/index3.mjs:1815:34)
  at getStreamAsString (node_modules/nuxi/dist/chunks/index3.mjs:2030:34)
  at <anonymous> (node_modules/nuxi/dist/chunks/index3.mjs:2218:24)
  at getSpawnedResult (node_modules/nuxi/dist/chunks/index3.mjs:2217:26)
  at <anonymous> (node_modules/nuxi/dist/chunks/index3.mjs:2504:94)
  at <anonymous> (node_modules/nuxi/dist/chunks/index3.mjs:2503:24)
  at onetime (node_modules/nuxi/dist/chunks/index3.mjs:813:28)
  at <anonymous> (node_modules/nuxi/dist/chunks/index3.mjs:2247:51)
  at processTicksAndRejections (:12:39) 



 ERROR  Command failed: node ./server/index.mjs                    12:08:33 AM
The first argument must be a Readable, a ReadableStream, or an async iterable.

error: script "preview" exited with code 1
Listening on http://[::]:3000   

I believe this requires modifications to nuxt, to be able to specify or detect the nitro preset, so that it's not always node-server. Explicit specification could be a --preset flag like vinxi start has.

@corbinu
Copy link

corbinu commented Jun 27, 2024

@birkskyum Here are also some lingering issues on other commands:

  1. After recent bun version upgrades the .nuxt server needs to be deleted to prevent a segfault in bun: nuxt with bun has crashed #11808
  2. Unable to use dependencies in nuxt that depend on the jose package: Export named 'diffieHellman' not found in module 'crypto' when running in Nuxt server with bun --bun dev #9569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests