react-native init 项目出现的问题

在创建React Native项目时遇到网络连接错误,提示'tunneling socket could not be established, cause=connect ETIMEDOUT'。尝试更换镜像源无效,通过检查配置发现存在'https-proxy'代理,删除后成功初始化项目。" 108286865,9909970,Neo4j图形数据库实践:语句详解(远程服务器),"['数据库', '图形数据库', 'Neo4j', 'Cypher']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This will walk you through creating a new React Native project in /Users/x'x'x/Desktop/ReactNativeWS/smstest

Using yarn v1.22.4

Installing react-native...

yarn add v1.22.4

info No lockfile found.

[1/4] 🔍  Resolving packages...

info There appears to be trouble with your network connection. Retrying...

info There appears to be trouble with your network connection. Retrying...

info There appears to be trouble with your network connection. Retrying...

info There appears to be trouble with your network connection. Retrying...

error An unexpected error occurred: "https://registry.npm.taobao.org/react-native: tunneling socket could not be established, cause=connect ETIMEDOUT 1.2.1.251:80".

info If you think this is a bug, please open a bug report with the information provided in "/Users/xxxx/Desktop/ReactNativeWS/smstest/yarn-error.log".

info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Error: Command failed: yarn add react-native --exact

    at checkExecSyncError (child_process.js:611:11)

    at execSync (child_process.js:647:15)

    at run (/usr/local/lib/node_modules/react-native-cli/index.js:294:5)

    at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3)

    at init (/usr/local/lib/node_modules/react-native-cli/index.js:200:5)

    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:153:7)

    at Module._compile (internal/modules/cjs/loader.js:1176:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)

    at Module.load (internal/modules/cjs/loader.js:1040:32)

    at Function.Module._load (internal/modules/cjs/loader.js:929:14) {

  status: 1,

  signal: null,

  output: [ null, null, null ],

  pid: 85487,

  stdout: null,

  stderr: null

}

最近遇到这样的问题,从网上搜索基本上统一提示更换镜像源,但是通过nrm 或者 yarn 各种更换都是没有效果的,此时

cause=connect ETIMEDOUT 1.2.1.251:80".

这个Timeout成功引起了我的注意,于是执行 yarn config list 进行查看,发现内部有个 https-proxy 代理,于是执行 yarn config delete https-proxy 代理,再次执行 react-native init smstest 成功!

特在此记录该问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值