Shrinkwrap 是否阻止我更新 react 和 react-dom? [英] Is Shrinkwrap preventing me from updating react and react-dom?

查看:47
本文介绍了Shrinkwrap 是否阻止我更新 react 和 react-dom?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 react 从 15.4.2 更新到 16.2.0.我关心的主要依赖是 React 和 React-Dom.我正在尝试运行:npm uninstall --save react react-dom 然后 npm install --save react react-dom 但是我不断收到消息:UNMET PEER DEPENDENCY react@16.2.0 react-dom@16.2.0 所以这让我认为这是一个缩小或束缚的依赖,但似乎无法找到它.我什至试图从 package.json 中的依赖项中删除 react 和 react-dom.还是没用.

解决方案

问题:

我的根本问题是我无法运行带有点击反应的材料 ui 组件,更具体地说是 Tabs 及其触摸/点击功能.真正的问题是我相信我在根文件夹中还有其他 node_modules,package.jsons,我的应用程序/组件位于不止一个 node_modulepackage.json 导致冲突的文件和文件夹.

解决:

  1. 从无法更新的应用复制您的业务逻辑
  2. 然后导航到/创建新目录并在那里搭建新的 React 项目(react-app 或在我的情况下 Yo @microsoft/sharepoint)
  3. 在未更新的应用程序中检查了 node_modules 文件夹和 package.json 中的 react、reactdom 版本,以查看它们是否为最新版本...它们不是,因此我进行了以下更新:

    3.2.npm install --save react react-dom (你可能需要先运行 npm uninstall react react-dom)

    3.3.npm install material-ui@latest

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

  4. 检查上述第 3 步中文件夹中的版本是否已更新...现在已更新.

  5. 尝试再次导入和创建点击反应应用程序组件,例如标签,现在它应该可以工作了

结论:导致问题的不是 Shrinkwrap 本身,而是 node_module 文件和/或 package.json 文件的重复.有关详细信息,请参阅Material-UI 标签已停止工作.

还要记住 Create React 应用程序不适用于某些版本的 React 和 React Dom.所以要小心这一点.

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.

解决方案

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.

这篇关于Shrinkwrap 是否阻止我更新 react 和 react-dom?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆