react-native初始化项目遇到的bug

bug如下:

error An unexpected error occurred: "https://registry.npm.taobao.org/0.7: Not found". info If you think this is a bug, please open a bug report with the information provided in "G:\learing\demo\projectapp\yarn-error.log". info Visit yarn add | Yarn for documentation about this command. Error: Command failed: yarn add 0.7 --exact at checkExecSyncError (node:child_process:828:11) at execSync (node:child_process:902:15)

在环境配置好后,我直接使用npx react-native init 项目名字 --version 0.7进行初始化项目。

 一开始,我去网上搜这种类型的bug的解决方法,都是说淘宝镜像没有切换,但是我按照网上说的去切换淘宝路径,结果切换了,再次init项目,还是这种结果。

于是后面我直接npx react-native init 项目名字 --version 0.68.2 

后面又出来了新的bug:

TypeError: cli.init is not a function at run (C:\Users\eveyi\AppData\Roam

结果,去网上找解决办法,后面重新init,出现如下bug:

warning Pattern ["@babel/runtime@^7.22.15"] is trying to unpack in the same destination "C:\Users\eveyi\AppData\Local\Yarn\Cache\v6\npm-@babel-runtime-7.22.15-38f46494ccf6cf020bd4eed7124b425e83e523b8-integrity\node_modules\@babel\runtime" as pattern ["@babel/runtime@^7.8.4"]. This could result in non-deterministic behavior, skipping. error metro-react-native-babel-preset@0.77.0: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.14.2" error Found incompatible module. info Visit yarn add | Yarn for documentation about this command. G:\learing\demo\proje\node_modules\metro-hermes-compiler\src\emhermesc.js:77 throw ex;

于是再次去chatgpt上搜索,才发现是node的版本太低了,我的node版本目前是16,上面说需要更新到18,于是我就去官网下载了nodejs18版本的,接着,就成功了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值