因为新换了电脑,重新安装vs code和 nodejs 跑前端项目,npm run install之后,vs code命令行出现错误:error: error:0308010C:digital envelope routines::unsupported
10% building 2/4 modules 2 active ...node_modules\webpack\hot\dev-server.js E
rror: 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:\workstation\adautotest_workstation\adautotest_web\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\workstation\adautotest_workstation\adautotest_web\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\workstation\adautotest_workstation\adautotest_web\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\workstation\adautotest_workstation\adautotest_web\node_modules\webpack\lib\NormalModule.js:503:5
at D:\workstation\adautotest_workstation\adautotest_web\node_modules\webpack\lib\NormalModule.js:358:12
at D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\workstation\adautotest_workstation\adautotest_web\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\workstation\adautotest_workstation\adautotest_web\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\workstation\adautotest_workstation\adautotest_web\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
10% building 2/5 modules 3 active ...workstation\adautotest_web\src\main.js n
ode:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
网上查了,可能是nodejs版本过高导致的错误:
解决办法:
在命令行跑下列命令:
set NODE_OPTIONS=--openssl-legacy-provider文章来源:https://www.toymoban.com/news/detail-566647.html
再次运行:npm run serve 成功 文章来源地址https://www.toymoban.com/news/detail-566647.html
到了这里,关于npm run serve出现错误 error:0308010C:digital envelope routines::unsupported的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!