URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'

  今天搭建antd的项目结构,本来项目是一个基础react项目,结果执行

  yarn create umi  

  yarn

  yarn start

  项目启动后访问突然报错URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico',搜索资料才知道,搭建node项目不能在一个项目上重新搭建,会出现统一库的多版本冲突,类似java冲的jar包冲突。

  这类错误最主要的就是安装了错误版本的 plugin 或 npm 包,对于项目原本的配置中在 package.json 文件中已经列出的 plugin 和 npm 包,不要再重复进行安装,否则可能重新安装的 plugin 或 npm 包版本是不适用的,从而造成出错。

  例如,CRA v2.1.1 脚手架项目原有的 html-webpack-plugin 版本是 v4.0.0-alpha.2,是不需要再另外进行安装的。如果此时开发人员自己执行了 yarn add html-webpack-plugin,从而将 html-webpack-plugin 的版本更换为了 v3.2.0,这就会造成构建报错:URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico' URIError: Failed to decode param '/%PUBLIC_URL%/manifest.json',其他主观错误类似。

1,html-webpack-plugin 版本错误

URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'
URIError: Failed to decode param '/%PUBLIC_URL%/manifest.json'

错误描述:在执行 yarn start 构建命令时报错,页面空白。
解决方法:html-webpack-plugin 版本错误,在本文的配置方案中,应当使用 "html-webpack-plugin": "4.0.0-alpha.2", 版本。

2,TypeError: Cannot read property 'state' of undefined(页面报错)

错误描述:编译构建过程没有报错,但页面报错:TypeError: Cannot read property 'state' of undefined。
解决方法:redux 版本错误,在本文的配置方案中,应当使用 redux <=3.7.2 版本。

  

原文地址:https://www.cnblogs.com/guanghe/p/10693989.html