【问题标题】:An unexpected error occurred: "https://registry.yarnpkg.com/react: unable to get local issuer certificate" while create-react-app发生意外错误:“https://registry.yarnpkg.com/react:无法获取本地颁发者证书”同时 create-react-app
【发布时间】:2021-01-15 09:58:53
【问题描述】:

我的 Windows 机器上安装了以下内容:

节点:v12.18.4

纱线:1.19.1

创建反应应用程序:3.4.1

我导航到文件夹 c:\temp,然后尝试使用以下命令创建 react 应用程序:

c:\temp>create-react-app react-test --scripts-version 1.1.5

在执行上述命令时,我看到以下错误:

Creating a new React app in C:\Temp\react-test.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.19.1
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: unable to get local issuer certificate".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Temp\\react-test\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd C:\Temp\react-test has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

任何人都可以通过提供解决此问题的指导来帮助我

【问题讨论】:

    标签: node.js reactjs create-react-app yarnpkg


    【解决方案1】:

    关闭 yarn/npm 配置中的 strict-ssl,然后重试

    yarn config set "strict-ssl" false -g
    

    npm config set "strict-ssl" false -g
    

    【讨论】:

    • 像魅力一样工作!谢谢
    • 是的。那成功了。谢谢。
    【解决方案2】:

    不是禁用 strict-ssl 的忠实粉丝。

    这对我有用

    yarn config set registry https://registry.npmjs.org
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-16
      • 2013-04-18
      • 2016-04-20
      • 2015-03-18
      • 2011-12-26
      • 1970-01-01
      • 2014-08-13
      • 2018-05-15
      相关资源
      最近更新 更多