最近写reacte的项目,在其他电脑下载依赖启动项目时候报错:
Starting the development server...
Error: error:0308010C:digital envelope routines::unsupported
xxxxxxx....
Node.js v18.17.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
主要是node17版本问题引起的问题,解决方式
- 第一种是降低node版本,使用node17以下版本
- 第二种在启动命令加语句命令`set NODE_OPTIONS=--openssl-legacy-provider &`
"scripts": {
"start": "set NODE_OPTIONS=--openssl-legacy-provider & react-scripts start",
},
改好之后直接启动项目
npm/pnpm run start || yarn