Is Shrinkwrap preventing me from updating react an

2019-08-19 08:14发布

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.

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-19 08:49

Some things you could try:

  • check the version of react and react-dom inside the node_modules/ folder
  • remove node_modules/ and reinstall it again to remove any stall dependencies
查看更多
倾城 Initia
3楼-- · 2019-08-19 09:11

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:

  1. Make a copy of your business logic from app where you cannot update
  2. Then navigate into/create new directory and Scaffolded new react project in there (react-app or in my case Yo @microsoft/sharepoint)
  3. 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 run npm uninstall react react-dom first)

    3.3. npm install material-ui@latest

    3.4 npm i --save react-tap-event-plugin@3.0.2

  4. Check if versions have updated in folders above in step 3...they have now.

  5. 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.

查看更多
登录 后发表回答