Tag: nuxt

  • Fixing Nuxt Installation: “ERROR TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)”

    Fixing Nuxt Installation: “ERROR TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)”

    Should I? Or shouldn’t I? This is what I keep asking myself every time I pack my bags for a vacation, short or long. Do I really need my MacBook Air on Koh Samui? Maybe I’ll get into a situation where a simple iPhone is not enough. Watching a movie, for example. Or writing code.

    tl;dr

    Downgrade Node.js via nvm from 25.x.x to 24.x.x (LTS):

      # Download 24.11.1 (LTS) version
      nvm install --lts
      
      # Apply version
      nvm use --lts
      
      # Verify Node.js version; should show: v24.11.1
      node -v
      Bash

      Install the dependencies with yarn instead of bun:

        yarn
        Bash

        Coding under Coconut Trees

        I get it, totally. Sitting on a 28°C-degree tropical island, surrounded by pristine beaches and a forest of coconut trees so high that they almost kiss the sun, doesn’t seem to be the ideal location to open a code editor and look at what other hotel guests may interpret as hieroglyphs.

        It’s not only nerdy, but outright sad. “There,” says the toddler to his dad, “he’s playing computer,” pointing at me with his finger. And dad? He says nothing but slowly shakes his head and is—once again—reinforced in his belief that people, the “generation X,” aren’t capable of going anywhere without their digital opium.

        “Test Something”

        On one hand, he’s right. On the other hand, he’s not. Without drifting off the actual topic like a dinghy in the Gulf of Thailand, I can only say: I had a very good reason.

        However, that reason had nothing to do with the error I encountered today for the first time. Long story short, I needed to clone one of my Nuxt 4 projects and run the development server to—let’s keep it vague because it doesn’t matter—test something.

        The usual steps:

        1. git clone https://gitlab.com/.../project
        2. cd project
        3. bun i

        “ERROR TTY initialization failed”

        And that’s where it went awry. As a side note: Whenever possible, I use the package manager bun. It works for the vast majority of projects, and it’s blazingly fast, especially once packages have been cached.

        But this time, bun i stopped with an error that didn’t really tell me much:

        ERROR  TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)
        Bash

        A quick Google search showed that I wasn’t the only one having this problem with the combination bun + Nuxt. The GitHub user corpix proposed a quick fix for this by setting export NUXT_TELEMETRY_DISABLED to 1. To me, however, this felt more like a hack than an actual solution, just like other fixes.

        Console showing ERROR TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)
        The error message in all its glory.

        What’s uv_tty_init?

        So I kept digging. It turns out that uv_tt_init has something to do with Nuxt’s telemetry module (hence corpix’ fix). The module tries to prompt you (via TTY) to opt in/out of analytics during initialization. However, bun has a known bug handling TTY streams on certain platforms(especially Windows, but also in non-interactive terminals), causing this EINVAL error.​

        What made things a whole lot clearer was when I tried to install Nuxt via good, old yarn. Reliably, it reported the same error, but this time with some information that could be fixed easily:

        The engine "node" is incompatible with this module. Expected version ">=18.0.0 <=24.x". Got "25.2.1"
        error Found incompatible module.
        Bash

        On the Safe Side with LTS

        Seems like Node.js 25.x.x doesn’t get along with the telemetry module. Luckily, using the Node Version Manager, or nvm, downgrading to 24.x.x was a matter of seconds. It downloads the LTS version 24.11.1, and developers usually make sure that their code works with the latest LTS.

        If you’re not sure whether you have nvm, simply run nvm -v. If it’s installed, it should give you its version number. At the time of writing this, I received 0.40.3.

        If the command wasn’t found, it’s quickly installed by running brew install nvm (I’m assuming we’re all on macOS here and have Homebrew installed). Pay attention to the installation, because at the end, you’ll have to copy some lines and add them to your .zshrc. This is what you’ve got to add at the bottom of your .zshrc:

        # NVM (Node Version Manager)
        export NVM_DIR="$HOME/.nvm"
        # This loads nvm
        [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  
        # This loads nvm bash_completion
        [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
        Bash

        Done? Great. Then restart your terminal or session, and you should then have access to the nvm command. And now, we

        1. download the latest LTS version via nvm install --lts
        2. and tell our project to use it by running nvm use --lts

        At this time, --lts means v24.11.1. The output in your terminal or console should be:

        Now using node v24.11.1 (npm v11.6.2)

        And that’s already it. You can leave Nuxt’s telemetry working instead of just suppressing the error, and reinstall your packages with bun i or yarn (or whatever package manager you prefer).

        Once all is installed properly, run bun dev or yarn dev and see your beautiful Nuxt page starting up. Grab yourself a fresh coconut while you’re waiting and go to the beach to wash off the nastiness of Node.js error messages.

        Enjoy your vacation!

      1. @apply in Tailwind CSS v4 and Vue Components doesn’t work—and it looks like it’s not going to be fixed anytime soon

        @apply in Tailwind CSS v4 and Vue Components doesn’t work—and it looks like it’s not going to be fixed anytime soon

        Tailwind CSS v4 sucks. There, I said it. I’m too lazy now to dig up the changelog and pick out the ⚡️- or other emoji-led list items that are supposed to be an improvement, so consider this article part of a user review of an otherwise amazing and actually fun to work with CSS framework, and part of a rant. One of them applies to the usage of @apply in Vue.js components. But that’s not where it ends.

        (more…)
      2. Nuxt v3.16 is out—and TailwindCSS doesn’t seem to like it and breaks styling after upgrade. Here’s how you can fix it

        Nuxt v3.16 is out—and TailwindCSS doesn’t seem to like it and breaks styling after upgrade. Here’s how you can fix it

        With big fanfare, Daniel Roe, the inventor and person in charge of Nuxt, proudly released the newest version of my favourite JavaScript framework on March 7, 2025: Nuxt v3.16. It promised better performance, better error handling, and a lot more. The full announcement blog post showed that all Nuxt contributors are proud of the new version. They also gave instructions on how to upgrade to v3.16 from previous versions—which immediately broke my Tailwind styling. However, thanks to the Nuxt community, I can now show you the easy fix to this problem.

        (more…)
      3. Enable or disable dark mode in Nuxt 3 with NuxtUI v2 and Tailwind with this easy plugin

        Enable or disable dark mode in Nuxt 3 with NuxtUI v2 and Tailwind with this easy plugin

        I love dark mode. With a few exceptions, all of the websites I visit, program, or use as apps on my iPhone have dark mode enabled. When it comes to Nuxt 3, my favorite front-end meta-framework, it can only be just a setting in the nuxt.conf.ts file.

        Or not?

        (more…)
      4. Nuxt v3 Error: “ERROR [unhandledRejection] Nuxt instance is unavailable!”

        Nuxt v3 Error: “ERROR [unhandledRejection] Nuxt instance is unavailable!”

        Another day, another Nuxt project. Nuxt has just released v3.14.1592, which I chose because I wanted to have a look at the unannounced Nuxt v4, which uses TailwindCSS v4 and other packages with major changes.

        So I ran the usual single-line command line to install Nuxt from scratch and I’m ready to explore—or so I had thought.

        (more…)
      5. Easy example: Create a Nuxt 3 API endpoint to store data into an SQLite database

        Easy example: Create a Nuxt 3 API endpoint to store data into an SQLite database

        If it hasn’t been obvious at this point, let me tell you: I am a huge fan of Nuxt 3. In my opinion, it’s the best JavaScript Meta-Framework that’s out there and in active development.

        But this snippet is not a eulogy for Nuxt. I’m sharing a rather long code snippet with you, written in TypeScript, that creates a Nuxt RESTful API endpoint. You can use this URL to send data to it via a POST HTTP request. It’ll then save the data into a local SQLite database file.

        (more…)