npm run serve 时抛出异常:error:0308010C
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\Item\springbootVue\springboot\vue\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\Item\springbootVue\springboot\vue\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\Item\springbootVue\springboot\vue\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\Item\springbootVue\springboot\vue\node_modules\webpack\lib\NormalModule.js:503:5
解决办法:
set NODE_OPTIONS=--openssl-legacy-provider
D:\Item\springboot\vue>set NODE_OPTIONS=--openssl-legacy-provider
D:\Item\springboot\vue>npm run serve
> vue@0.1.0 serve
> vue-cli-service serve
就可以运行成功了
主要原因是版本不兼容的问题