您现在的位置是:首页 > 技术教程 正文

nodejs版本过高导致vue-cli项目无法正常运行解决方案

admin 阅读: 2024-04-01
后台-插件-广告管理-内容页头部广告(手机)

报错信息:

  1. Error: error:0308010C:digital envelope routines::unsupported
  2. at new Hash (node:internal/crypto/hash:71:19)
  3. at Object.createHash (node:crypto:133:10)
  4. at module.exports (D:\project\cylink-ui\node_modules\webpack\lib\util\createHash.js:135:53)
  5. at NormalModule._initBuildHash (D:\project\cylink-ui\node_modules\webpack\lib\NormalModule.js:417:16)
  6. at handleParseError (D:\project\cylink-ui\node_modules\webpack\lib\NormalModule.js:471:10)
  7. at D:\project\cylink-ui\node_modules\webpack\lib\NormalModule.js:503:5
  8. at D:\project\cylink-ui\node_modules\webpack\lib\NormalModule.js:358:12
  9. at D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3
  10. at iterateNormalLoaders (D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
  11. at iterateNormalLoaders (D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
  12. at D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:236:3
  13. at runSyncOrAsync (D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
  14. at iterateNormalLoaders (D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
  15. at Array.<anonymous> (D:\project\cylink-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
  16. at Storage.finished (D:\project\cylink-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
  17. at D:\project\cylink-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
  18. node:internal/crypto/hash:71
  19. this[kHandle] = new _Hash(algorithm, xofLen);
  20. ^
  21. Error: error:0308010C:digital envelope routines::unsupported
  22. at new Hash (node:internal/crypto/hash:71:19)
  23. at Object.createHash (node:crypto:133:10)
  24. at module.exports (D:\project\cylink-ui\node_modules\webpack\lib\util\createHash.js:135:53)
  25. at D:\project\cylink-ui\node_modules\graceful-fs\graceful-fs.js:123:16
  26. at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  27. opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  28. library: 'digital envelope routines',
  29. reason: 'unsupported',
  30. code: 'ERR_OSSL_EVP_UNSUPPORTED'
  31. }
  32. Node.js v18.13.0

由于nodejs版本过高,导致vue-cli项目运行报错。

 解决方案1:每次启动项目前,输入配置命令:

set NODE_OPTIONS=--openssl-legacy-provider

解决方案2:修改package.json配置文件:

修改前:

修改后:

 修改内容:

  1. "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --open",
  2. "build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report",
  3. "build:stage": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging",
  4. "preview": "set NODE_OPTIONS=--openssl-legacy-provider && node build/index.js --preview",

标签:
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

在线投稿:投稿 站长QQ:1888636

后台-插件-广告管理-内容页尾部广告(手机)
关注我们

扫一扫关注我们,了解最新精彩内容

搜索