[英]Migration to React 16.0.0 Error: Cannot find module “react/lib/ReactComponentTreeHook”
Trying to migrate from react 15.6.1
to 16.0.0
. 尝试从
react 15.6.1
迁移到16.0.0
。 I have updated my package.json, to "react": "16.0.0","react-dom": "16.0.0",
(only things I changed so far), and from what I've understood from the changelogs, things should have gone smoothly. 我已经将package.json更新为
"react": "16.0.0","react-dom": "16.0.0",
(仅到目前为止已更改的内容),以及从更改日志中了解的内容,事情应该顺利进行。 But they don't! 但是他们没有! From what I understand, they removed the
/lib
part in the v16.0.0
, hence why the module cannot be found? 据我了解,他们删除了
v16.0.0
的/lib
部分,因此为什么找不到该模块?
Am I missing something obvious? 我是否缺少明显的东西?
Would appreciate any help!
将不胜感激! :)
:)
You probably have two copies of React loaded. 您可能已经加载了两个React副本。
Try this in your terminal: 在您的终端中尝试以下操作:
npm ls react
And also: 并且:
npm ls react-dom
If either of these commands shows more than one result, then you have two copies of React, and that is not supported . 如果这些命令中的任何一个显示了多个结果,则您有两个React副本,并且不受支持 。
Delete all copies except the ones in the root node_modules
, and file an issue with projects that specify React as a dependency
. 删除除根
node_modules
中的所有副本以外的所有副本,并对将React指定为dependency
项目提出问题。 It must be a peerDependency
so that a situation like this doesn't occur. 必须是
peerDependency
这样才不会发生这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.