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版本的,接着,就成功了。