如何在NextJs中找到我的警告位置

huangapple go评论62阅读模式
英文:

How can I find my warning place in NextJs

问题

我在我的代码中有一些警告,但我找不到它们出现的位置。我该如何找到警告的位置?

这是我的控制台中的警告:

    在表格
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在表格(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:97587:79)
    在 div
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在 Paper(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:84171:79)
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在 TableContainer(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:95943:79)
    在 InnerThemeProvider(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
    在 ThemeProvider(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
    在 ThemeProvider(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
    在 BasicTable(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132450:20)
    在 p
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在 Typography(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:101212:84)
    在 div
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在 Box(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
    在 div
    在 TabPanel(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132631:24)
    在 div
    在 div
    在 div
    在 SwipeableViews(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:211683:34)
    在 div
    在 http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
    在 Box(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
    在 InnerThemeProvider(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
    在 ThemeProvider(http.dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
    在 ThemeProvider(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
    在 ProductMetaReview(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132677:19)
    在 div
    在 div
    在 ProductSingleDetails(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132920:20)
    在 div
    在 Container(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:134071:23)
    在 ProductPage(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:137283:24)
    在 main
    在 div
    在 Layout(http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:131448:23)
    在 UIProvider(http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12728:72)
    在 CartProvider(http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12113:99)
    在 ManagedUIContext(http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12912:23)
    在 Hydrate(http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:67267:23)
    在 QueryClientProvider(http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234

<details>
<summary>英文:</summary>

I have some warning in my code, but I can&#39;t found where those happened. How can I find the place of warning?

This is my warning in console

react_devtools_backend.js:2655 Warning: validateDOMNesting(...): <table> cannot appear as a descendant of <p>.
at table
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Table (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:97587:79)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Paper (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:84171:79)
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at TableContainer (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:95943:79)
at InnerThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
at BasicTable (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132450:20)
at p
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Typography (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:101212:84)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Box (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
at div
at TabPanel (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132631:24)
at div
at div
at div
at SwipeableViews (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:211683:34)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Box (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
at InnerThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
at ProductMetaReview (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132677:19)
at div
at div
at ProductSingleDetails (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132920:20)
at div
at Container (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:134071:23)
at ProductPage (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:137283:24)
at main
at div
at Layout (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:131448:23)
at UIProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12728:72)
at CartProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12113:99)
at ManagedUIContext (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12912:23)
at Hydrate (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:67267:23)
at QueryClientProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:67342:21)
at PresenceChild (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:18809:23)
at AnimatePresence (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:18970:23)
at CustomApp (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:13178:25)
at I18nextProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:54335:19)
at AppWithTranslation
at ErrorBoundary (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:725:47)
at ReactDevOverlay (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:841:23)
at Container (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:8855:5)
at AppContainer (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:9351:24)
at Root (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:9490:25)


</details>


# 答案1
**得分**: 1

你可以运行一个搜索,一起查找这些字符串,以找到在您的代码库中首次出现关于同时使用“table”和“p”的警告的位置。这可以帮助您识别问题的确切代码行。

另一种方法是通过保留某些代码片段的注释并测试警告是否消失来隔离问题。这可以帮助您识别有问题的代码并解决问题。

<details>
<summary>英文:</summary>

You can run a search for these strings together to find the place in your codebase where a warning about the use of &quot;table&quot; and &quot;p&quot; together first appeared. This can assist you in identifying the precise lines of code that are the problem.


Another method is to isolate the issue by leaving certain code snippets uncommented and testing to see if the warning disappears. This can assist you in identifying the troublesome code and resolving the issue.

</details>



# 答案2
**得分**: 1

检查位于“products”文件夹下包含`<table>`元素的所有组件。

你是否在`<p>`内部使用了`<table>`?

<details>
<summary>英文:</summary>

Check all your components under `products` folder which contains `&lt;table&gt;` element. 

Are you using `&lt;table&gt;` inside `&lt;p&gt;`?

</details>



huangapple
  • 本文由 发表于 2023年4月4日 14:10:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926007.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定