Cannot read properties of undefined (reading ‘styles‘),使用webpack5搭建vue项目,vue-loader报错解决

这篇具有很好参考价值的文章主要介绍了Cannot read properties of undefined (reading ‘styles‘),使用webpack5搭建vue项目,vue-loader报错解决。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

跟着官网,尝试在webpack5中加载vue文件时报错:
Cannot read properties of undefined (reading ‘styles’)

其中版本vue-loader@17.0.0,vue-template-compiler和vue都是2.7

百度之后看到有人说是vue-loader版本问题,然后在vue-loader的github的issue里找到了相关的问答:
Cannot read properties of undefined (reading ‘styles‘),使用webpack5搭建vue项目,vue-loader报错解决,vue.js,前端,webpack
意思是vue2的话,vue-loader版本要低于等于15。

于是运行npm rm vue-loader,卸载17版本的vue-loader后,再安装15版本的npm i vue-loader@15 -D,最终不再报错,并能对vue文件进行加载。文章来源地址https://www.toymoban.com/news/detail-818400.html

到了这里,关于Cannot read properties of undefined (reading ‘styles‘),使用webpack5搭建vue项目,vue-loader报错解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Cannot read properties of undefined (reading ‘key‘)

    如标题所示错误,直译是key为undefined。本次是因为使用了element-ui中的el-table组件所以并不是key为undefined,而是后台返回的key有重复。 当key重复就会出现页面卡死的现象,渲染就会失败。 key在使用时我们要注意: 1.在渲染时该识别为不同时,识别为相同 2.在渲染时该识别为相

    2024年02月03日
    浏览(28)
  • 【解决】el-tree报Cannot read property ‘getCheckedKeys‘ of undefined Cannot read property 'getCheckedKeys' of undefined

    如果你报错 或者  只要在你的在el-tree上加个这个,就可以了   ref=\\\"tree\\\"  

    2024年02月14日
    浏览(67)
  • 解决Cannot read properties of undefined (reading ‘resetFields‘)

    第一天做项目中遇到了这一个问题关于resetField重置校验报错的问题,   然后去网上查找问题的原因,但是找到问题的原因是: mouted加载table数据以后,隐藏的 Dialog 并没有编译渲染进 dom 里面。所以当通过点击事件,Dialog 弹出的时候,$refs 并没有获取到 dom 元素导致 ‘reset

    2023年04月23日
    浏览(68)
  • Uncaught TypeError: Cannot read properties of null (reading ‘style‘)

    Uncaught TypeError: Cannot read properties of null (reading \\\'style\\\') 2:报错的原因 文档的加载过程是自上向下加载。使用未命名的变量、会报错 3;解决办法 1、将Javascript代码从标签中放入body中 2、 window.onload = function(){}框起来

    2024年02月15日
    浏览(28)
  • [已解决]Cannot read properties of undefined (reading ‘install‘)

    唉,对于计算机的bug是真的很害怕。但是这个错误,我发现解决起来还是蛮简单的。 参考这篇博客: (2条消息) 错误“Cannot read properties of undefined (reading ‘install‘) at Vue.use” 的解决方案_cannot read properties of undefined (reading \\\'inst_FunSober的博客-CSDN博客 原因主要就是我们在下载

    2024年02月13日
    浏览(32)
  • TypeError: Cannot read properties of undefined (reading ‘map‘)

    控制台报错 TypeError: Cannot read properties of undefined (reading \\\'map\\\') 我的错误原因: 第一次页面渲染的时候,map的对象是undefined或null, 解决方法: 在前面加个要进行判断,当有值时再去遍历

    2024年02月07日
    浏览(37)
  • TypeError: Cannot read properties of undefined (reading ‘replace‘)

    错误一:TypeError: Cannot read properties of undefined (reading \\\'replace\\\') 错误二:[Vue warn]: inject() can only be used inside setup() or functional conponents. 解释:当我们使用内置 use开头的钩子函数时,不能进行嵌套去拿实例。如: 解决:必须在 setup函数 第一层调用。

    2024年02月11日
    浏览(35)
  • 当vue3 报错 Cannot read properties of null (reading ‘style‘)

    当你在编写代码时 发现页面不及时刷新了 浏览器控制台报下面的错误 时刚看到的时候会一很懵 那么原因是什么呢 原因是:尽管Vue 3允许一个组件模板中存在多个元素,但是如果你这样写,有时会出现上述错误。 解决方法:在模板内你写的多个标签外面包裹一层元素,或者

    2024年02月12日
    浏览(40)
  • Uncaught TypeError: Cannot read properties of undefined (reading ‘use‘)

    报错:Uncaught TypeError: Cannot read properties of undefined (reading ‘use’) 原因:Vue-router版本问题,在vue-router3可在router/index.js中安装router插件,但4不支持 解决: 1、在router/index.js中,导出{createRouter, createWebHistory}两个函数 使用createRouter来创建路由对象 使用createWebHistory函数赋值给histor

    2024年02月13日
    浏览(32)
  • Uncaught TypeError: Cannot read properties of undefined (reading ‘remove‘)

    在Vue 3中,你可能会遇到“Uncaught TypeError: Cannot read properties of undefined (reading \\\'remove\\\')”这样的错误,这通常是因为在组件销毁时,尝试访问已经被销毁的元素或事件监听器。 为了解决这个问题,你可以在组件销毁之前,确保移除所有的事件监听器和其他可能导致问题的操作。

    2024年01月20日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包