Skip to content

Version 1.6.6 resulted in Unexpected token '{' error on Nuxt project #136

Open

Description

@guilherme-moneri

Environment

nuxt: "^2.13.0"
node: 14.21.3

Reproduction

Not sure

Describe the bug

This update messed with something and I started receiving this error stack when opening my Nuxt project:

SyntaxError: Unexpected token '{'

at wrapSafe (internal/modules/cjs/loader.js:1029:16)
at Module._compile (internal/modules/cjs/loader.js:1078:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Module.require (internal/modules/cjs/loader.js:1003:19)
at require (internal/modules/cjs/helpers.js:107:18)
at Object.<anonymous> (node_modules/node-fetch-native/dist/index.cjs:1:80)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)

Downgrading to 1.6.4 resolved the issue.

Additional context

No response

Logs

Activity

  1. imzedi commented on Jan 23, 2025

    @imzedi

    Facing the same issue on exact environment

  2. pi0 commented on Jan 24, 2025

    @pi0
    Member

    Can you please share a reproduction?

    Nuxt 2 is EOL, it might be an old bundler support issue.

  3. LeoonLiang commented on Feb 13, 2025

    @LeoonLiang

    Facing the same issue on exact environment

  4. OrkhanAlikhanov commented on May 20, 2025

    @OrkhanAlikhanov

    Facing the same issue. A breaking change shouldn't be published under a minor version bump. Probably author didn't expect this to be a breaking change. But it is for legacy projects

  5. lumirelle commented on Aug 2, 2025

    @lumirelle
    Contributor

    I found out that this issue is caused by /dist/node.cjs.

    In version 1.6.6, /dist/node.cjs contains static block syntax, which Node 14 does not support:

    Image

    And in version 1.6.4, this file does not use the static block syntax.

    Image

    Maybe this issue is caused by the changed behavior of unbuild or esbuild?

  6. pi0 commented on Aug 2, 2025

    @pi0
    Member

    1.6.7 released with lowered ES2020 target (thanks @lumirelle for #145)

    Can someone please confirm if it fixes issues?

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions