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

  今天搭建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 版本。

相關文章
相關標籤/搜索