[英]Error: Command failed: yarn add react-native@latest - React Native
I've been trying to start a new React Native project but have been facing this issue for a few days, tried searching for it on a lot of forums but couldn't find any solution that works for me.我一直在尝试启动一个新的 React Native 项目,但几天来一直面临这个问题,尝试在很多论坛上搜索它,但找不到适合我的解决方案。
The commands I've tried:我试过的命令:
npx react-native init MyApp
npx react-native init MyApp --template react-native-template-typescript
npx --ignore-existing react-native init MyApp --template react-native-template-typescript
Someone mentioned removing react-native-CLI using:有人提到使用以下方法删除 react-native-CLI:
npm uninstall -g react-native-cli
andyarn global remove react-native-cli
npm uninstall -g react-native-cli
andyarn global remove react-native-cli
Still, no luck.仍然,没有运气。 Would be great if anyone could help out.
如果有人可以提供帮助,那就太好了。
BTW, I've Node version 14.1.0顺便说一句,我有 Node 版本 14.1.0
Your version of node ( 14.1.0
) doesn't meet the requirements of the template project.您的节点版本 (
14.1.0
) 不符合模板项目的要求。
If you want to stick to node 14, use ^14.15.0
, otherwise switch to node 16 (LTS), and re-run the command.如果要坚持使用节点 14,请使用
^14.15.0
,否则切换到节点 16 (LTS),然后重新运行命令。
Check if your "C:\Users\YourUser" has a folder named "node_modules" and/or a file named "package.json" and/or a file named "yarn.lock".检查您的“C:\Users\YourUser”是否有名为“node_modules”的文件夹和/或名为“package.json”的文件和/或名为“yarn.lock”的文件。 If you have them create a new folder (name it whatever you want) and move "node_modules" and/or "package.json" and/or "yarn.lock" to that new folder.
如果你让他们创建一个新文件夹(随便命名)并将“node_modules”和/或“package.json”和/或“yarn.lock”移动到该新文件夹。 Exit the folder and try to init the project again.
退出文件夹并再次尝试初始化项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.