admin管理员组文章数量:1021143
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.
The mands 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:
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
Here is the error from terminal
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.
The mands 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:
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
Here is the error from terminal
Share Improve this question asked Nov 3, 2021 at 12:32 AminAmin 411 silver badge5 bronze badges 3- Did you get any resolve ?. I am facing the same issue ! – Ron Astle Lobo Commented Dec 11, 2021 at 6:11
-
2
I had to uninstall yarn to make it work,
npm uninstall -g yarn
– Ron Astle Lobo Commented Dec 11, 2021 at 6:22 - @RonAstleLobo and what if he wants to use Yarn instead of NPM? – showtime Commented Dec 17, 2022 at 23:36
5 Answers
Reset to default 1Your version of node (14.1.0
) doesn't meet the requirements of the template project.
If you want to stick to node 14, use ^14.15.0
, otherwise switch to node 16 (LTS), and re-run the mand.
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". 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. Exit the folder and try to init the project again.
You have yarn in your system and to proceed with react-native need to uninstall yarn
npm: npm uninstall -g yarn
brew: brew uninstall yarn
tarball: rm -rf "$HOME/.yarn"
ubuntu: sudo apt-get remove yarn && sudo apt-get purge yarn
centos: yum remove yarn
windows: choco uninstall yarn
(or go to control panel > add/remove programs and uninstall it from there)
Same problem I Faced when I try to run this mand in vs code editor integrated terminal, but I try this on power shell it work fine. So, once try in this way
If C:\Users\username isn't intended to be a project, remove any yarn.lock and/or package.json file there.
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.
The mands 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:
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
Here is the error from terminal
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.
The mands 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:
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
Here is the error from terminal
Share Improve this question asked Nov 3, 2021 at 12:32 AminAmin 411 silver badge5 bronze badges 3- Did you get any resolve ?. I am facing the same issue ! – Ron Astle Lobo Commented Dec 11, 2021 at 6:11
-
2
I had to uninstall yarn to make it work,
npm uninstall -g yarn
– Ron Astle Lobo Commented Dec 11, 2021 at 6:22 - @RonAstleLobo and what if he wants to use Yarn instead of NPM? – showtime Commented Dec 17, 2022 at 23:36
5 Answers
Reset to default 1Your version of node (14.1.0
) doesn't meet the requirements of the template project.
If you want to stick to node 14, use ^14.15.0
, otherwise switch to node 16 (LTS), and re-run the mand.
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". 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. Exit the folder and try to init the project again.
You have yarn in your system and to proceed with react-native need to uninstall yarn
npm: npm uninstall -g yarn
brew: brew uninstall yarn
tarball: rm -rf "$HOME/.yarn"
ubuntu: sudo apt-get remove yarn && sudo apt-get purge yarn
centos: yum remove yarn
windows: choco uninstall yarn
(or go to control panel > add/remove programs and uninstall it from there)
Same problem I Faced when I try to run this mand in vs code editor integrated terminal, but I try this on power shell it work fine. So, once try in this way
If C:\Users\username isn't intended to be a project, remove any yarn.lock and/or package.json file there.
本文标签: javascriptError Command failed yarn add reactnativelatestReact NativeStack Overflow
版权声明:本文标题:javascript - Error: Command failed: yarn add react-native@latest - React Native - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745552631a2155701.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论