0

enter image description hereWhen I type

npm view react version 

I get 16.13.1.

How can I fix this? I need to use 15.6.2

I already tried npm install @. I think I have 15.6.2 but the newer react version of 16.13.1 is overriding it. How can I fix this?

beginner
  • 121
  • 6
  • update the version in the package.json for both react and react-dom and run `npm install`. You might have to do changes in your code given there's a breaking change. For that, check out the [changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md) to see anything impacts you – Gonzalo.- Sep 23 '20 at 15:46
  • @Gonzalo.- Am I allowed to do that. My advisor (I'm a HS intern) gave me the package.json and idt I can edit that. Is there any way for me to just go down to 15.6.2? – beginner Sep 23 '20 at 15:48

1 Answers1

0

You should try: npm install react@version

look at this solution: How to install a previous exact version of a NPM package?

Adi
  • 11
  • 1
  • 6
  • I tried that and it says: + react@15.6.2 updated 1 package and audited 3541 packages in 37.44s. But when I typed in npm view react version , I get 16.13.1. – beginner Sep 23 '20 at 16:02
  • Do I need to delete 16.13.1.? – beginner Sep 23 '20 at 16:08
  • can you post your package.json file? and you could try npm install packge@version --save – Adi Sep 23 '20 at 16:08
  • I did npm install and basically it downloaded all these dependencies except the following: ├── UNMET PEER DEPENDENCY react-dom@15.6.2, ├── UNMET PEER DEPENDENCY react@15.6.2, ├── UNMET PEER DEPENDENCY eslint@5.16.0, ├── UNMET PEER DEPENDENCY webpack@4.44.2. I'm not sure why though. It's been frustrating me all morning. – beginner Sep 23 '20 at 16:12
  • I tried npm install packge@version --save and it unfortunately doesn't work. I think it downloaded but the newer 16.13.1 version is overriding it or something – beginner Sep 23 '20 at 16:17
  • I guess the problem is coming from that react-dom depends ion the react version so you should downgrade them both together – Adi Sep 23 '20 at 16:21
  • So npm install react@version react-dom@version? – beginner Sep 23 '20 at 16:22
  • check this solution: https://stackoverflow.com/questions/49252594/downgrade-to-react-15-6-2-from-react-16-2-0-failed – Adi Sep 23 '20 at 16:23