Skip to content

Error when using the "Unified (router-agnostic)" imports (Error: Cannot find module '/node_modules/next/navigation'…) #869

@tordans

Description

@tordans

Context

What's your version of nuqs?

    "nuqs": "2.3.1",

What framework are you using?

  • ✅ Next.js (app router)
  • ✅ Next.js (pages router)

Which version of your framework are you using?

% npx next info

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 18:40:14 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.9.0
  npm: 11.0.0
Relevant Packages:
  next: 14.2.23 // An outdated version detected (latest is 15.1.6), upgrade is highly recommended!
  eslint-config-next: 14.2.23
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.3
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 15.1.6), upgrade is highly recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Description

I migrated from "nuqs": "1.20.0" to "nuqs": "2.3.1" and followed the https://github.com/47ng/nuqs/blob/next/errors/NUQS-404.md docs to use import { NuqsAdapter } from 'nuqs/adapters/next' since we are using both, the pages and app folder.

Error: Cannot find module '/node_modules/next/navigation' imported from /node_modules/nuqs/dist/chunk-S37JZELB.js
Did you mean to import "next/navigation.js"?

I changed the imports to use the separate /app and /pages imports in the corresponding files and the error was gone.

Suggestion

Reevaluate the section https://nuqs.47ng.com/docs/adapters#nextjs-unified of the docs, it looks like that does not work as intended

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions