• npm报错error:0308010C:digital envelope routines::unsupported


    error:0308010C:digital envelope routines::unsupported
    出现这个错误是因为 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响.

    在node.js V17以前一些可以正常运行的的应用程序,但是在 V17 及以上版本可能会抛出以下异常:

    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:130:10)
        at module.exports.__webpack_modules__.57442.module.exports (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:135907:62)
        at NormalModule._initBuildHash (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109317:16)
        at handleParseError (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109371:10)
        at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109403:5
        at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109258:12
        at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:61157:3
        at iterateNormalLoaders (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60998:10)
        at Array.<anonymous> (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60989:4) {
      opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
      library: 'digital envelope routines',
      reason: 'unsupported',
      code: 'ERR_OSSL_EVP_UNSUPPORTED'
    }
    
    Node.js v18.7.0
    ✨  Done in 1.92s.

    据说可以通过运行以下命令行临时解决这个问题

    export NODE_OPTIONS=--openssl-legacy-provider

    但目前测试并不行,所以重新安装了node-v16.12.0,npm也安装了对应版本

    node与npm版本对应关系参考https://nodejs.org/zh-cn/download/releases/

  • 相关阅读:
    metasploit生成payload的格式
    Win10专业版激活
    用Python对html进行编码
    ubuntu服务器搭建DVWA站点
    brew安装和换源
    生命中的最后一天【转】
    基础博弈
    jQuery-4.动画篇---jQuery核心
    jQuery-4.动画篇---自定义动画
    jQuery-4.动画篇---动画切换的比较(toggle与slideToggle以及fadeToggle的比较)
  • 原文地址:https://www.cnblogs.com/cherylgi/p/16528249.html
Copyright © 2020-2023  润新知