Skip to content

Undici v6 imported by @nuxt/scripts since v1.3.4 #887

Description

@fredericDelaporte

Undici v6 is imported by @nuxt/scripts since v1.3.4 at least up to v1.3.8.

In our case, it conflicts in some hidden way with our own import of undici v8, causing our nitro plugin for enabling the cache (inexistent in v6) to fail, failing our startup, but only on actual servers, not in dev mode.

import { setGlobalDispatcher, Agent, interceptors } from 'undici';

export default defineNitroPlugin(() => {
  setGlobalDispatcher(new Agent().compose(interceptors.cache()));
});

=>

Application has thrown an uncaught exception and is terminated:
TypeError: interceptors.cache is not a function
    at file:///D:/frontend/server/chunks/_/nitro.mjs:8221:18
    at runNitroPlugins (file:///D:/XVRT/frontend/server/chunks/_/nitro.mjs:18122:7)
    at file:///D:/frontend/server/chunks/_/nitro.mjs:18133:1
    at ModuleJob.run (node:internal/modules/esm/module_job:439:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async node:internal/modules/esm/loader:643:26

Workaround: add a package override to force undici v8 to be picked-up.

It seems a few PR have been done to cease bringing Undici through @nuxt/scripts, like #860 and #870. Is it possible to remove it entirely from @nuxt/scripts?

(I have tried a repro on Stackblitz, but I have been unable to repro on it or on a dev workstation.)

Activity

  1. harlan-zw commented on Aug 29, 2026

    @harlan-zw
    Collaborator

    Please try the v2 beta 🙏 It removes the dep

  2. added
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Aug 29, 2026
  3. 14 remaining items

  4. added
    harlan-agent-wait-to-implementIssue triage found work that should wait before implementation.
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Aug 31, 2026
  5. fredericDelaporte commented on Sep 1, 2026

    @fredericDelaporte
    Author

    I have tried the beta, but that fails on npm i with errors I do not understand well.

    npm error code ERESOLVE
    npm error ERESOLVE could not resolve
    npm error
    npm error While resolving: valap-web@1.18.0
    npm error Found: @nuxt/scripts@1.3.8
    npm error node_modules/@nuxt/scripts
    npm error   @nuxt/scripts@"2.0.0-beta.5" from the root project
    npm error
    npm error Could not resolve dependency:
    npm error @nuxt/scripts@"2.0.0-beta.5" from the root project
    npm error
    npm error Conflicting peer dependency: @unhead/vue@3.4.0
    npm error node_modules/@unhead/vue
    npm error   peer @unhead/vue@"^3.3.1" from @nuxt/scripts@2.0.0-beta.5
    npm error   node_modules/@nuxt/scripts
    npm error     @nuxt/scripts@"2.0.0-beta.5" from the root project
    npm error
    npm error Fix the upstream dependency conflict, or retry
    npm error this command with --force or --legacy-peer-deps
    npm error to accept an incorrect (and potentially broken) dependency resolution.
    

    There is no v 1.3.8 in my package.json anymore.

    Checking npm ls @unhead/vue shows we have a v2.1.17 dependency indirectly coming from @nuxtjs/seo v3.4.0. If that is the reason, well, we know v3.4 is outdated, but that we cannot upgrade due to it requiring @nuxtjs/i18n >= v10, that we cannot upgrade to higher than v9 due to some breaking change in v10+ causing our async setup of i18n to be broken with it. (Reported nowhere, we have not find a way to repro it with a simple project.)

    So, better not wait for us to confirm how it goes with v2. We may take long time to do it.

    Edit: our trouble with upgrading i18n is now diagnosed, and reported. nuxt-modules/i18n#4150. It looks like it could be fixed soon, then we could get back to the subject here.

  6. added
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Sep 1, 2026
  7. added
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Sep 8, 2026
  8. fredericDelaporte commented on Sep 10, 2026

    @fredericDelaporte
    Author

    I have now been able to check with the beta. The trouble is not there with v2.0.0-beta.6.

  9. added
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Sep 10, 2026
  10. lorypelli commented on Oct 10, 2026

    @lorypelli

    @danielroe fixed with v2 I guess

  11. lorypelli commented on Oct 10, 2026

    @lorypelli

    10. I have now been able to check with the beta. The trouble is not there with v2.0.0-beta.6.

    so, is it fixed now?

  12. fredericDelaporte commented on Oct 10, 2026

    @fredericDelaporte
    Author

    It would be fixed for me if I could actually used the beta, but that is not the case due to issues in other packages.

    About whether it should be considered fixed from the viewpoint of this repo or not, I do not know its policy.

    As far as I know, it is at least fixed in a beta. Does it stay open for considering back-porting it to v1 or something else? No idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    harlan-agent-wait-to-implementIssue triage found work that should wait before implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions