标签“img”的父标签是“span”,但只能是“i-amphtml-sizer-intrinsic”。错误 不允许自定义 JavaScript

Posted

技术标签:

【中文标题】标签“img”的父标签是“span”,但只能是“i-amphtml-sizer-intrinsic”。错误 不允许自定义 JavaScript【英文标题】:parent tag of tag 'img' is 'span', but it can only be 'i-amphtml-sizer-intrinsic'. error Custom JavaScript is not allowed 【发布时间】:2020-12-14 23:02:44 【问题描述】:

error 标签“img”的父标签是“span”,但只能是“i-amphtml-sizer-intrinsic”。 错误 不允许自定义 javascript。 https://amp.dev/documentation/guides-and-tutorials/learn/validation-workflow/validation_errors/#custom-javascript-is-not-allowed

在异步构建时 (/home/vrch/Desktop/vrch-next/node_modules/next/dist/build/index.js:37:212) npm 错误!代码生命周期 npm 错误!错误号 1 npm 错误! vrch-next@1.0.0 导出:cross-env-shell NODE_ENV=isDev "next build && next export && node sitemap_generator.js" npm 错误!退出状态 1 npm 错误! npm 错误! vrch-next@1.0.0 导出脚本失败。 npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志: npm 错误!主页/vrch/.npm/_logs/2020-08-26T07_12_23_654Z-debug.log

导出带有 AMP 页面的 react.js 项目时显示错误

    我没有在 AMP 中使用过 javascript 即使在评论所有 AMP 页面后,仍然会出现错误!

【问题讨论】:

您好,欢迎来到 ***。请花一些时间阅读帮助页面,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。此外,请阅读Stack Overflow question checklist。还可以了解如何发帖Minimal, Complete, and Verifiable Examples。 【参考方案1】:

出现这个错误是因为组件内不允许使用 amp 页面的 html 元素,您应该使用 amp 标签本身。 p

【讨论】:

以上是关于标签“img”的父标签是“span”,但只能是“i-amphtml-sizer-intrinsic”。错误 不允许自定义 JavaScript的主要内容,如果未能解决你的问题,请参考以下文章

第二 html/css总结

Js/如何操作div下面的span元素或者是img之类的标签元素

img标签与span一起使用不在同一条线上

img/input等部分标签是行内标签,为什么也可以设置宽和高

无法定位元素

CSS基础