4

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 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:

npm uninstall -g react-native-cli and yarn 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

Amin
  • 41
  • 1
  • 3

4 Answers4

1

Your 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 command.

Ivanka Todorova
  • 9,964
  • 16
  • 66
  • 103
  • 1
    In my case npm version is below 7, so addition to this updated npm with 'sudo npm install --global npm@7' – Thanhal P A Mar 05 '22 at 08:46
  • I got the same error and Google leads me here. I use node 12 and then I switched to node 16 and error gone. This is a weird error message. – Wayne Mao Aug 25 '22 at 01:47
0

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.

0

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)

0

Same problem I Faced when I try to run this command in vs code editor integrated terminal, but I try this on power shell it work fine. So, once try in this way

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 08 '23 at 08:22