Node OpenSSL 错误

运行时提示错误:

PS C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin> yarn serve                         
yarn run v1.22.22
$ vue-cli-service serve
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
 INFO  Starting development server...
10% building 2/5 modules 3 active ...0!C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\babel-loader\lib\index.js!C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\eslint-loader\index.js??ref--14-0!C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\src\main.jsError: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array.<anonymous> (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at C:\WorkDir\iSharkFly\Source-Code\UI\Ui-Skote\Vuejs\Admin\node_modules\graceful-fs\graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v22.17.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

这是因为代码没有更新,使用的 SSL 在新的 OpenSSL 版本中已经不适用了。

需要进行升级。

也可以通过设置参数来解决:

set NODE_OPTIONS=--openssl-legacy-provider