【Vue-Element-admin】由于node.js版本过高报错(Mac):Error: error:0308010C:digital envelope routines::unsupported

不兼容版本及报错

系统环境:

node.js: v17.6.0

npm: 8.5.1

运行npm run dev 报错

//报错
 INFO  Starting development server...
10% building 2/5 modules 3 active /Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/hot/dev-server.jsError: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at module.exports (/Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/admin/Desktop/universe/universe_admin_base/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Users/admin/Desktop/universe/universe_admin_base/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/admin/Desktop/universe/universe_admin_base/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/admin/Desktop/universe/universe_admin_base/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

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

Node.js v17.6.0

使用node版本降级解决了该问题(Mac):

(1)安装node版本管理模块n

sudo npm install n -g

(2)版本降级/升级

以往的版本 | Node.jsNode.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.https://nodejs.org/zh-cn/download/releases/

sudo n 版本号

例如:sudo n 16.14.2

最后成功了:

 INFO  Starting development server...
98% after emitting CopyPlugin

 DONE  Compiled successfully in 8090ms                                                                                                    23:13:49


  App running at:
  - Local:   http://localhost:9528/ 
  - Network: http://192.168.1.102:9528/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hiphon001

分享日常bug解决方案

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值