?
?node 版本為16時報錯,node 版本升級到20時報錯:
95% emitting CompressionPlugin ERROR? Error: error:0308010C:digital envelope routines::unsupported
?
解決方案:
??? "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
原因分析:
這個錯誤是由于在Vue項目中使用了CompressionPlugin插件而引起的。具體錯誤信息是"95% emitting CompressionPlugin ERROR Error: error:0308010C:digital envelope routines::unsupported"。根據引用,這個錯誤與OpenSSL的版本有關。在node.js V17版本中最近發(fā)布的OpenSSL3.0對允許算法和密鑰大小增加了嚴格的限制,可能會對生態(tài)系統(tǒng)造成一些影響。因此,可能是由于OpenSSL3.0的限制導致CompressionPlugin插件在構建過程中出現(xiàn)了錯誤。
解決這個問題的方法之一是在構建命令中設置一個環(huán)境變量,以使用舊版本的OpenSSL。根據引用,可以在構建命令中添加以下內容:
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
這樣設置后,構建命令將使用舊版本的OpenSSL,從而解決了該錯誤。請確保在使用該命令時,將其替換為實際使用的命令。
另外,引用提到了一種方法,即通過打開終端并按照說明粘貼一些命令來解決該問題。但是由于這個方法不一定適用于所有情況,所以可能需要嘗試其他解決方案。
總結起來,95% emitting CompressionPlugin ERROR Error: error:0308010C:digital envelope routines::unsupported錯誤是由于OpenSSL3.0的限制導致CompressionPlugin插件在構建過程中出現(xiàn)了錯誤。解決該問題的方法之一是在構建命令中設置一個環(huán)境變量,使用舊版本的OpenSSL。另外,還可以嘗試其他解決方案,如引用中提到的方法。
參考鏈接:
https://wenku.csdn.net/answer/7cef2kqfkm文章來源:http://www.zghlxwxcb.cn/news/detail-762102.html
?https://chat.xutongbao.top/文章來源地址http://www.zghlxwxcb.cn/news/detail-762102.html
到了這里,關于95% emitting CompressionPlugin ERROR Error: error:0308010C:digital envelope routines::unsupported的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!