xugaoyi / vuepress-theme-vdoing

🚀一款简洁高效的VuePress知识管理&博客(blog)主题
https://doc.xugaoyi.com
MIT License
4.34k stars 1.12k forks source link

[提问]: 在 yarn dev 的時候出錯 #647

Open mmm25002500 opened 1 year ago

mmm25002500 commented 1 year ago

在 yarn dev 的時候出錯

重现步骤(可选)

  1. yarn install 沒問題
  2. yarn dev 救出問題了
╭─tershi@tershi-archlinux /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing  ‹master*› 
╰─➤  yarn dev    
yarn run v1.22.19
$ node --max_old_space_size=4096 ./node_modules/vuepress/cli.js dev docs
wait Extracting site metadata...
tip add sidebar data. 成功生成侧边栏数据。
tip Apply theme vuepress-theme-vdoing ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
tip Apply plugin sitemap (i.e. "vuepress-plugin-sitemap") ...
tip Apply plugin baidu-autopush (i.e. "vuepress-plugin-baidu-autopush") ...
tip Apply plugin baidu-tongji (i.e. "vuepress-plugin-baidu-tongji") ...
tip Apply plugin thirdparty-search (i.e. "vuepress-plugin-thirdparty-search") ...
tip Apply plugin one-click-copy (i.e. "vuepress-plugin-one-click-copy") ...
tip Apply plugin demo-block (i.e. "vuepress-plugin-demo-block") ...
tip Apply plugin zooming (i.e. "vuepress-plugin-zooming") ...
tip Apply plugin comment (i.e. "vuepress-plugin-comment") ...
tip Apply plugin @vuepress/last-updated (i.e. "@vuepress/plugin-last-updated") ...

● Client █████████████████████████ building (40%) 1/2 modules 1 active
 node_modules/webpack-dev-server/client/index.js

ℹ 「wds」: Project is running at http://0.0.0.0:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/docs/.vuepress/public
ℹ 「wds」: 404s will fallback to /index.html
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/webpack/lib/NormalModule.js:471:10)
    at /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/webpack/lib/NormalModule.js:503:5
    at /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/webpack/lib/NormalModule.js:358:12
    at /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /mnt/sdc1/Project/Docusaurus/vuepress-theme-vdoing/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'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

請問我該如何解決?謝謝!

naichaduck commented 1 year ago

我也是这个问题,找到解决方法了吗?

mmm25002500 commented 1 year ago

找到了~ 可以看 這篇

Linux/Unix 下: export NODE_OPTIONS=--openssl-legacy-provider Win CMD下: set NODE_OPTIONS=--openssl-legacy-provider Win PWSH下: $env:NODE_OPTIONS = "--openssl-legacy-provider"

yuanfoudev commented 1 year ago

这个问题超级好,同样也遇到了, 并且成功使用楼上的方法解决了。