Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

having an issue creating new react app with create-react-app

I am trying to create a new react project, but when I run npx create-react-app tik-tok-clone I get the following error

    Creating a new React app in C:\Users\mwars\Documents\GitHub\TikTok-Clone\tik-tok-clone.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^10 || ^12 || >=14". Got "13.12.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd C:\Users\mwars\Documents\GitHub\TikTok-Clone\tik-tok-clone has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting tik-tok-clone/ from C:\Users\mwars\Documents\GitHub\TikTok-Clone
Done.

I've been trying to figure it out for a while now and just can't get it to work.

like image 766
Michael Grant Warshowsky Avatar asked Jan 25 '23 16:01

Michael Grant Warshowsky


1 Answers

I am was dealing with the same problem and have managed to understand and fix it. I will try to explain it below.

The issue:

error [email protected]: The engine "node" is incompatible with this module. Expected version "^10 || ^12 || >=14". Got "13.12.0"

This is telling you that the create_react_app module is only compatible with versions 10, 12, or greater than 14 of node and you are using 13.12.0.

The solution

To fix this error you need to either upgrade or downgrade your current version of node.

One way to do this is to use NVM (node version manager) to manage multiple versions of node.

To install it with either Linux or Mac you can use either of the following commands

For Wget, run the following command on the terminal:

  wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

For CURL, run the following:

  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

You will want to change the version number in the commands to the latest stable version.

Once you have downloaded it successfully restart the terminal or you won't be able to find it. If this fails you may need to reset your computer.

If you have NVM installed running the following should show you the current version of it your using.

nvm --version

You can then use the following command to list available versions of node

nvm ls-remote

Select a compatible version and install it like so

nvm install 14.15.0

Running

node -v 

Should show this as your current version if not try

nvm use v14.15.0

You should now have no issues running

npx create-react-app tik-tok-clone
like image 160
Gino Avatar answered Jan 29 '23 15:01

Gino