Node v20.5.1运行Zoom React会议SDK示例遇ERR_OSSL_EVP_UNSUPPORTED错误
解决Zoom React会议SDK示例启动时的ERR_OSSL_EVP_UNSUPPORTED错误
问题重现
运行Zoom React会议SDK示例项目,执行npm start时出现以下错误:
Error: error:0308010C:digital envelope routines::unsupported....
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
已尝试设置Node选项:
"scripts": { "start": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start", "build": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build" }
并将Node版本从v20.5.1降级至18.xx、19.xx版本,问题仍未解决。
有效解决方法
1. 修正Windows下的Node选项设置
你当前的脚本里重复写了set SET,这会导致环境变量设置无效,修正为:
"scripts": { "start": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start", "build": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts build" }
如果是macOS/Linux系统,直接去掉set:
"scripts": { "start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start", "build": "NODE_OPTIONS=--openssl-legacy-provider react-scripts build" }
2. 清除缓存并重新安装依赖
执行以下命令彻底清理缓存和依赖:
# 删除node_modules和lock文件 rm -rf node_modules package-lock.json yarn.lock # 清除npm缓存 npm cache clean --force # 重新安装依赖 npm install
3. 使用nvm锁定Node版本到16.x
部分旧版React项目对Node 18+兼容性不佳,建议用nvm切换到Node 16.x:
# 若未安装nvm,先完成安装 # 安装Node 16.x nvm install 16 # 切换到Node 16 nvm use 16
之后重新执行npm install和npm start。
4. 升级react-scripts版本
如果项目使用的react-scripts版本过低,升级到最新稳定版:
npm install react-scripts@latest
内容的提问来源于stack exchange,提问作者Devon McGrath
相关产品推荐
相关产品推荐

