今天搭建antd的项目结构,原本项目是一个基础react项目,结果执行html
yarn create umi java
yarnnode
yarn startreact
项目启动后访问忽然报错URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico',搜索资料才知道,搭建node项目不能在一个项目上从新搭建,会出现统一库的多版本冲突,相似java冲的jar包冲突。webpack
这类错误最主要的就是安装了错误版本的 plugin 或 npm 包,对于项目本来的配置中在 package.json 文件中已经列出的 plugin 和 npm 包,不要再重复进行安装,不然可能从新安装的 plugin 或 npm 包版本是不适用的,从而形成出错。web
例如,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'
,其余主观错误相似。npm
1,html-webpack-plugin 版本错误json
URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'
URIError: Failed to decode param '/%PUBLIC_URL%/manifest.json'redux
错误描述:在执行 yarn start
构建命令时报错,页面空白。
解决方法:html-webpack-plugin 版本错误,在本文的配置方案中,应当使用 "html-webpack-plugin": "4.0.0-alpha.2",
版本。antd
2,TypeError: Cannot read property 'state' of undefined(页面报错)
错误描述:编译构建过程没有报错,但页面报错:TypeError: Cannot read property 'state' of undefined。
解决方法:redux 版本错误,在本文的配置方案中,应当使用 redux <=3.7.2 版本。