Vue开发中安装库或者插件时候经常报错

在这里插入图片描述

解决方案

在安装内容的命令后面加上

--legacy-peer-deps

如:

PS E:\web\project-SHP\app\src> npm i less-loader --legacy-peer-deps
added 1 package in 2s

注意空格

运行过程中报错:Module build failed: Error: Cannot find module ‘less’

用上述方式安装 less即可

PS E:\web\project-SHP\app> npm install less --legacy-peer-deps
>>

added 13 packages in 3s

// 成功运行
  App running at:
  - Local:   http://localhost:8080/
  - Network: http://10.33.201.152:8080/

项目开发过程中报错:code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While Vuex中dispatch没有被定义

  • 在一般情况下书写没有任何问题的时候,观察vue版本和vuex版本是否出现了差错,重新安装vuex的版本即可

项目运行时控制台报错:Refused to apply style from ‘http://localhost:8080/iconfont.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

在这里插入图片描述

在这里插入图片描述
查看自己项目文件夹中是否进行引入了iconfont.css文件,有的话进行注销即可

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐