hematopoietic
hematopoietic

Reputation: 87

Npm unable to install template dependencies

I am currently trying to create-react-app with --template typescript but I am getting the following error:

Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/BrianKim/.npm/eresolve-report.txt for a full report.

I've tried updating npm as well as node, but cannot get create-react-app to work at all. Please let me know what I could do, thanks!

Upvotes: 4

Views: 2956

Answers (3)

Shivang.J
Shivang.J

Reputation: 1

I faced the same issue ...what worked for me is :

  1. Just use this command and press enter:

    npm config set legacy-peer-deps true

  2. then start creating your react app:

    npx create-react-app your-app

    cd your-app

    npm start

    • if error in npm start; then use this command and start again:

    -> npm install ajv@^8 ajv-keywords@^5

    -> npm start

Upvotes: 0

Artem
Artem

Reputation: 1

This solved my issue. Maybe it will help somebody.

  1. Installed React dependencies in my project using:

    npm install react@latest react-dom@latest

  2. Installed yarn using:

    npm install --global yarn

  3. Followed by running:

    yarn create react-app client --template typescript

Following command did not work for me at all:

npx create-react-app client --template typescript

After successful installation, I was able to go into the folder client and launched the app by running npm start.

Upvotes: 0

I just installed "yarn" using "npm install --global yarn" and after that I installed react using "yarn create react-app my-app --template typescript" and everything worked fine for me without errors.

Upvotes: 2

Related Questions