continuing-cyan
continuing-cyan2mo ago

Next.js 14 - Module '"next/navigation"' has no exported member 'usePathname'.

GitHub
[NEXT-671] Next.js 13.2.1 - Module '"next/navigation"' has no expor...
Verify canary release I verified that the issue exists in the latest Next.js canary release1 Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Ve...
8 Replies
kapa.ai
kapa.ai2mo ago
Hi @Atroci. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources provided do not contain information about the specific issue you're encountering with Next.js 14 and the 'usePathname' export from 'next/navigation'. I recommend checking the official Next.js documentation or their GitHub issues for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@189504778089398272> kapa.ai is still learning and improving, please let us know how it did by reacting below
continuing-cyan
continuing-cyan2mo ago
I'm having this issue
continuing-cyan
continuing-cyan2mo ago
Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000 Binaries: Node: 16.15.1 npm: 8.11.0 Yarn: 1.22.19 pnpm: 7.18.2 Relevant packages: next: 13.2.1 eslint-config-next: 13.2.1 react: 18.2.0 react-dom: 18.2.0 Which area(s) of Next.js are affected? (leave empty if unsure) Routing (next/router, next/navigation, next/link) Link to the code that reproduces this issue https://stackblitz.com/edit/nextjs-q4nrme?file=package.json,tsconfig.json,pages%2Findex.tsx To Reproduce import { usePathname } from 'next/navigation'; export default function Home() { const pathname = usePathname(); return <div>Pathname: {pathname}</div>; } Describe the Bug Hook usePathname works as expected, it returns current path name however typescript throws an error which doesn't allow you to build the page. Typescript error: Module '"next/navigation"' has no exported member 'usePathname'. As a temporary solution I used // @ts-ignore to suppress the error for now. Expected Behavior Typescript type of usePathname needs be exported correctly and typescript error should disappear. Which browser are you using? (if relevant) No response How are you deploying your application? (if relevant) No response
StackBlitz
Nextjs (forked) - StackBlitz
The React framework for production.
continuing-cyan
continuing-cyan2mo ago
@kapa.ai Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000 Binaries: Node: 16.15.1 npm: 8.11.0 Yarn: 1.22.19 pnpm: 7.18.2 Relevant packages: next: 13.2.1 eslint-config-next: 13.2.1 react: 18.2.0 react-dom: 18.2.0 Which area(s) of Next.js are affected? (leave empty if unsure) Routing (next/router, next/navigation, next/link) Link to the code that reproduces this issue https://stackblitz.com/edit/nextjs-q4nrme?file=package.json,tsconfig.json,pages%2Findex.tsx To Reproduce import { usePathname } from 'next/navigation'; export default function Home() { const pathname = usePathname(); return <div>Pathname: {pathname}</div>; } Describe the Bug Hook usePathname works as expected, it returns current path name however typescript throws an error which doesn't allow you to build the page. Typescript error: Module '"next/navigation"' has no exported member 'usePathname'. As a temporary solution I used // @ts-ignore to suppress the error for now. Expected Behavior Typescript type of usePathname needs be exported correctly and typescript error should disappear. Which browser are you using? (if relevant) No response How are you deploying your application? (if relevant) No response
StackBlitz
Nextjs (forked) - StackBlitz
The React framework for production.
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I'm sorry, but the knowledge sources provided do not contain information about the specific issue you're encountering with Next.js and the 'usePathname' export from 'next/navigation'. I recommend checking the official Next.js documentation or their GitHub issues for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@189504778089398272> kapa.ai is still learning and improving, please let us know how it did by reacting below
sensitive-blue
sensitive-blue2mo ago
Hey @Atroci, we cannot help without knowing when this error is thrown and without knowing about your project setup. Do you use Pages router or App router, what are your versions for the related packages (Refine packages and next.js). Can you share the output of refine whoami command of @refinedev/cli?