首页 > 其他分享 >记Redux下载后,运行examples/todos时,报错Error: error:0308010C:digital envelope routines::unsupported 和 Failed

记Redux下载后,运行examples/todos时,报错Error: error:0308010C:digital envelope routines::unsupported 和 Failed

时间:2023-12-03 23:12:26浏览次数:45  
标签:load 0308010C -- react start 报错 build scripts test

1、Redux 下载

下载地址

git clone https://github.com/reactjs/redux.git

进入examples/todos,下载依赖:

npm install

2、问题复现及解决

执行命令

npm run start

此时终端报错:

Error: error:0308010C:digital envelope routines::unsupported

解决方法:

打开 package.json,修改 scripts

  "scripts": {
    "start": "react-scripts start",
    "build": "export react-scripts build",
    "eject": "react-scripts eject",
    "test": "react-scripts test --env=node"
  },

如果是mac,则改为:

  "scripts": {
    "start": "export NODE_OPTIONS=--openssl-legacy-provider;react-scripts start",
    "build": "export NODE_OPTIONS=--openssl-legacy-provider;react-scripts build",
    "eject": "react-scripts eject",
    "test": "react-scripts test --env=node"
  },

如果是window,则改为:

  "scripts": {
    "start": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts build",
    "eject": "react-scripts eject",
    "test": "react-scripts test --env=node"
  },

再次运行npm run start,报错

Failed to load config "react-app" to extend from.

这里我是将 redux/.eslintrc.cjs 文件里面的内容给注释了

module.exports = {
  // extends: 'react-app',
 // ...
}

此时再次运行 npm run start,项目正常启动

标签:load,0308010C,--,react,start,报错,build,scripts,test
From: https://www.cnblogs.com/zhenshu/p/17873985.html

相关文章