类型错误:无法读取未定义的属性“insertAfter”

问题描述 投票:0回答:2

当我尝试使用“yarn dev”运行项目的前端(位于 next.js 中)时,它会抛出此错误:

error - ./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[2].oneOf[6].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[2].oneOf[6].use[2]!./styles/global.css

TypeError: Cannot read property 'insertAfter' of undefined

根据我目前发现的情况,该错误很可能与 webpack 有关 我在这里发现了类似的问题(不是确切的问题):

https://github.com/vercel/next.js/issues/23795

https://github.com/thetinywebagency/thetinywebagency.github.io/issues/1

这两个链接中提到的解决方案对我的情况没有帮助。 如果有人解决了问题,需要帮助...

webpack next.js typeerror node-modules insertafter
2个回答
0
投票

问题与顺风有关

error - ./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[2].oneOf[6].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[2].oneOf[6].use[2]!./styles/global.css 

检查您的

./styles/global.css


0
投票

检查你的styles.scss

找到这一行:@apply text-surface;

然后执行此操作或删除

//@应用文本表面;

© www.soinside.com 2019 - 2024. All rights reserved.