最近項目組里來了個新人,電腦node版本10.2...前端項目采用webpack5構建,啟動前端項目時,一直存在報錯
錯誤詳情:
ERROR in Error: require(...).pathToFileURL is not a function
- index.html:93
/Users/zhou/Desktop/app/public/index.html:93:51
- index.html:112
/Users/zhou/Desktop/app/public/index.html:112:13
- index.html:123
/Users/zhou/Desktop/app/public/index.html:123:12
- index.js:142 HtmlWebpackPlugin.evaluateCompilationResult
[app]/[html-webpack-plugin]/index.js:142:28
- index.js:324 Promise.resolve.then
[app]/[html-webpack-plugin]/index.js:324:26
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
html-webpack-plugin對應版本是5.x版本
當時在其他人的電腦上,其實都沒有這個構建錯誤,感覺就是個環境問題

仔細看了下文檔,現在webpack5有最低的node版本要求,因此升級對應版本就可以了
