MAC系统node:internal/crypto/hash:80 this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHas

node:internal/crypto/hash:80
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:80:19)
    at Object.createHash (node:crypto:139:10)
    at getFileName (/Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/webpack-theme-color-replacer/src/Handler.js:33:38)
    at Handler.handle (/Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/webpack-theme-color-replacer/src/Handler.js:23:26)
    at /Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/webpack-theme-color-replacer/src/index.js:22:26
    at _next1 (eval at create (/Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at eval (eval at create (/Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:29:1)
    at /Users/c0015/Desktop/代码/低代码/mp-galaxy/node_modules/copy-webpack-plugin/dist/index.js:91:9 {
  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 v20.12.2
error Command failed with exit code 1.

报错原因 node.js版本太高了
MAC系统node:internal/crypto/hash:80 this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHas_第1张图片
看以前是node 16版本 而自己设置是node 20
电脑有安装多版本使用
nvm use 16.17.0
切换低版本
再次运行

yarn serve

即可正常启动了,
MAC系统node:internal/crypto/hash:80 this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHas_第2张图片

还保存其他异常可以将原来 的 yarn.lock / node_modules 删掉重新
yarn install 然后 yarn serve
即可

你可能感兴趣的:(macos,vscode)