代码之家  ›  专栏  ›  技术社区  ›  santosh kumar patro

发生意外错误:“https://registry.yarnpkg.com/react:创建react应用程序时无法获取本地颁发者证书

  •  0
  • santosh kumar patro  · 技术社区  · 6 年前

    我的windows计算机上安装了以下内容:

    节点:v12.18.4

    纱线:1.19.1

    创建反应应用程序:3.4.1

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

    c: \temp>创建react-app-react-test脚本版本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.
    

    有人能在这里帮助我解决这个问题吗

    0 回复  |  直到 6 年前
        1
  •  44
  •   anhquan    5 年前

    关闭yarn/npm配置上的严格ssl,然后重试

    yarn config set "strict-ssl" false -g
    

    或

    npm config set "strict-ssl" false -g
    
        2
  •  7
  •   Arun A    4 年前

    不太喜欢禁用严格的ssl。

    这对我奏效了

    yarn config set registry https://registry.npmjs.org
    
        3
  •  0
  •   Codemaker2015    3 年前

    逐一执行以下命令以解决问题。

    npm config set registry https://registry.npmjs.org/
    npm config set "strict-ssl" false -g
    npm config delete registry
    
    推荐文章