英文:
Next.js 13 App Directory route grouping throwing "Non matching path () provided for /(public)"
问题
我正在尝试为每个路由组创建不同的布局,有3个布局:auth、dashboard和public。但是当我对路由进行分组时,出现了错误消息"提供了不匹配的路径(),用于/(public)"。以下是我的文件夹结构:
结构是否有问题?还是我漏掉了什么?
英文:
I'm trying to create a different layout for each route groups, there's 3 layouts: auth, dashboard, and public. But when I group the routes, the error "Non matching path () provided for /(public)" occured. Here's my folder structure:
Is there something wrong with the structure? Or is there something i missed?
答案1
得分: 2
在NextJs版本13.4.12中使用Turbopack时,我遇到了这个错误。简单来说,通过从package.json脚本中移除"dev": "next dev ---turbo"并替换为"dev": "next dev."来再次使用webpack。至少在目前的beta版本中,可能会出现一些错误。
英文:
In NextJs version 13.4.12 with Turbopack, I'm getting that error. Simply, use webpack again by removing "dev": "next dev ---turbo" from the package.json script and replace it with "dev": "next dev." At least for now, in beta, it may have some errors.
答案2
得分: 0
根据我的理解和文件,文件夹 (public)
仅用于分组,不会被视为路径,为了使路由可访问,您需要将 page.js
放入另一个文件夹,例如 (public)/public/page.js
。这将使其可以通过 /public
路由访问。
英文:
As far as my understanding and according to the documents, the folder (public )
is only for grouping and won't be consider a path, in order to make the route accessible you need to put the page.js
inside another folder eg: (public)/public/page.js
This will make it accessible by /public
route.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论