I am trying to update react from 15.4.2 to 16.2.0. Main dependencies I am concerned about is React and React-Dom. I am trying to run: npm uninstall --save react react-dom
and then npm install --save react react-dom
however I keep getting the message: UNMET PEER DEPENDENCY react@16.2.0 react-dom@16.2.0
so this makes me think it's a shrink or tied down dependency but can't seem to find it. I have tried to even remove react and react-dom from the dependencies in package.json. Still no avail.
问题:
回答1:
Issue:
My root issue is I coudn't run material ui components with tap react and more specifically the Tabs and it's touch/tap feature. Real problem is I believe I had other node_modules,package.jsons
in root folder where my app/components were in so more than one node_module
and package.json
files and folders which caused the clash.
To resolve:
- Make a copy of your business logic from app where you cannot update
- Then navigate into/create new directory and Scaffolded new react project in there (react-app or in my case Yo @microsoft/sharepoint)
Checked the react, reactdom versions in node_modules folder and package.json from within the application that's not updating to see if they're latest versions...they weren't so I did the following updates:
3.2.
npm install --save react react-dom
(you may have to runnpm uninstall react react-dom
first)3.3.
npm install material-ui@latest
3.4
npm i --save react-tap-event-plugin@3.0.2
Check if versions have updated in folders above in step 3...they have now.
- Try to import and create tap react app components again e.g. Tabs and now it should work
Conclusion: It was not Shrinkwrap itself that was causing the issue but the duplication of node_module files and/or package.json files. See Material-UI Tabs have stopped working for more info.
Also remember Create React app will not work with some versions of React and React Dom. So be wary of this.
回答2:
Some things you could try:
- check the version of
react
andreact-dom
inside thenode_modules/
folder - remove
node_modules/
and reinstall it again to remove any stall dependencies