简体   繁体   English

为什么我不能使用 expo init 命令创建 React native 项目?

[英]Why can't I create a React native project using the expo init command?

I have installed Expo for this to configure the proxy and the installation was successful.我为此安装了Expo来配置代理,安装成功。

npm install -g expo-cli

Then I executed the following command line:然后我执行了以下命令行:

expo init AwesomeProject

But I get the following error:但我收到以下错误:

 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.

What could be happening?会发生什么?

I've tried many solutions eventually only this works for me, just to intercept the request and modify the options before sending request.我尝试了很多解决方案,最终只有这个对我有用,只是为了拦截请求并在发送请求之前修改options

File Name文件名

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

Code代码

// 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');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM