【问题标题】:Why can't I create a React native project using the expo init command?为什么我不能使用 expo init 命令创建 React 原生项目?
【发布时间】:2020-01-22 00:51:25
【问题描述】:

我为此安装了Expo来配置代理,安装成功。

npm install -g expo-cli

然后我执行了以下命令行:

expo init AwesomeProject

但我收到以下错误:

C:\Users\sault>expo init awesomeProject
? Choose a template: expo-template-blank
request to https://registry.npmjs.org/expo-template-blank failed, reason: connect ETIMEDOUT 104.16.18.35:443
Set EXPO_DEBUG=true in your env to view the stack trace.

会发生什么?

【问题讨论】:

    标签: node.js react-native npm expo


    【解决方案1】:

    我尝试了很多解决方案,最终只有这个对我有用,只是为了在发送请求之前拦截请求并修改options

    文件名

    /Users/[your user name]/.config/yarn/global/node_modules/minipass-fetch/lib/index.js
    

    代码

    // pick an npm registry host as you like
    if (options.host === 'registry.npmjs.org') {
      options.host = 'registry.npm.taobao.org';
      options.hostname = 'registry.npm.taobao.org';
      options.href.replace('registry.npmjs.org', 'registry.npm.taobao.org');
    }
    

    【讨论】:

      猜你喜欢
      • 2023-02-11
      • 2019-04-18
      • 2019-11-16
      • 2022-07-30
      • 2019-02-28
      • 1970-01-01
      • 1970-01-01
      • 2020-11-17
      • 2020-10-15
      相关资源
      最近更新 更多