【问题标题】:Create React App - unable to get local issuer certificate创建 React App - 无法获取本地颁发者证书
【发布时间】:2020-03-06 08:41:52
【问题描述】:

基于https://github.com/facebook/create-react-app我运行:

npx create-react-app my-app

但我收到此错误:

error An unexpected error occurred: "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz: unable to get local issuer certificate".

我一周前尝试过,它适用于另一个项目。现在它似乎不再起作用了。 未创建文件夹结构。

我尝试将 strict-ssl 设置为 false,但它不能解决问题。有什么建议吗?

【问题讨论】:

  • 尝试创建一个名为 my-app 的文件夹,在 my-app 文件夹中打开终端,然后运行 ​​npx create-react-app . 或者如果问题仍然存在,请尝试使用 npm : npm install create-react-app -g 然后create-react-app my-app
  • 在他们的文档中,他们不建议这样做:“如果您以前通过 npm install -g create-react-app 全局安装了 create-react-app,我们建议您使用 npm 卸载该软件包卸载 -g create-react-app 以确保 npx 始终使用最新版本。”
  • @paulalexandru 谢谢你,你建议卸载 create-react-app global 为我修复了它。

标签: reactjs ssl npm certificate create-react-app


【解决方案1】:

将严格的 ssl 标志设置为 false 对我有用

纱线: yarn config set "strict-ssl" false -g

npm: npm config set "strict-ssl" false -g

【讨论】:

  • 请更详细地描述解决方案,并提供更多见解,例如解释实际原因,添加工作代码 sn-p 和执行以消除问题的步骤。有关更多详细信息,请访问 StackOverflow 的指南。
【解决方案2】:

尝试设置严格的 ssl 'false',它对我有用

yarn config set "strict-ssl" false -g

【讨论】:

    【解决方案3】:

    我有这个问题,所以我会回答,因为我没有找到其他主题的解决方案。

    要解决此问题,请尝试:

    npm install create-react-app -g 然后 npm audit fix

    所以,然后再试一次

    npx create-react-app your-app-name

    它有效!

    【讨论】:

      猜你喜欢
      • 2016-04-20
      • 2020-09-16
      • 1970-01-01
      • 2017-08-31
      • 2018-07-04
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多