Skip to content

Node 25 warning on import: --localstorage-file was provided without a valid path #1336

@PaulRBerg

Description

@PaulRBerg

Context

What's your version of nuqs?

What framework are you using?

  • ✅ Next.js (app router)
  • ❌ Next.js (pages router)
  • ❌ React SPA (no router)
  • ❌ Remix
  • ❌ React Router
  • ❌ Other

Which version of your framework are you using?

Additional environment:

node v25.6.0
macOS (arm64)

Description

Importing nuqs/server on Node 25 emits this warning:

(node:XXXX) Warning: `--localstorage-file` was provided without a valid path
    at Object.get (node:internal/webstorage:32:25)

In my app this appears during next dev (Turbopack) because server code imports nuqs/server for createSearchParamsCache.

From tracing, this happens at module evaluation time in nuqs debug code (isDebugEnabled) that probes localStorage.

Reproduction

Minimal Node-only repro (no Next required):

mkdir nuqs-node25-repro && cd nuqs-node25-repro
npm init -y
npm i [email protected]
NODE_OPTIONS=--trace-warnings node -e "import('nuqs/server').then(() => console.log('loaded'))"

Observed output includes:

loaded
(node:...) Warning: `--localstorage-file` was provided without a valid path
    at Object.get (node:internal/webstorage:32:25)
    at isDebugEnabled (node_modules/nuqs/dist/server.js:...)

Expected:

  • Importing nuqs/server in a server/runtime context should not touch localStorage at module top-level.
  • No Node webstorage warning should be emitted.

Potential direction:

  • Gate debug-localStorage checks behind typeof window !== 'undefined' (or defer the check to client-only paths).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions