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

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

不兼容版本及报错

系统环境:

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. (/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. (/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.

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/567436.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-09
下一篇 2022-04-09

发表评论

登录后才能评论

评论列表(0条)

保存