最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】Reactjs出错:Uncaught Error Cannot find module react/lib/ReactComponentTreeHook

ReactJS crifan 2074浏览 0评论

折腾:

【已解决】使用react-hot-boilerplate去集成ReactJS-AdminLTE

期间,用代码:

import React, { Component } from ‘react’;
import adminlteReactjs from ‘adminlte-reactjs’;
export default class App extends Component {
  render() {
    console.log(adminlteReactjs);
    let ProfileCard = adminlteReactjs.ProfileCard;
    console.log(ProfileCard);
    
    return (
      <h1>Hello, world.
        <ProfileCard />
      </h1>
    );
  }
}

出错:

Uncaught Error: Cannot find module “react/lib/ReactComponentTreeHook”
    at webpackMissingModule (eval at <anonymous> (bundle.js:1902), <anonymous>:16:94)
    at Object.eval (eval at <anonymous> (bundle.js:1902), <anonymous>:16:203)
    at eval (eval at <anonymous> (bundle.js:1902), <anonymous>:361:30)
    at Object.<anonymous> (bundle.js:1902)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.eval (eval at <anonymous> (bundle.js:1896), <anonymous>:19:24)
    at eval (eval at <anonymous> (bundle.js:1896), <anonymous>:24:30)
    at Object.<anonymous> (bundle.js:1896)
    at __webpack_require__ (bundle.js:556)
ERROR in ./~/adminlte-reactjs/~/react-dom/lib/ReactDOMUnknownPropertyHook.js
Module not found: Error: Cannot resolve module ‘react/lib/ReactComponentTreeHook’ in /Users/crifan/dev/dev_root/daryun/Projects/上汽大众/斯柯达/卓越零售 RSE/sourcecode/web/AdminManagement/reference/react-hot-boilerplate/react-hot-boilerplate/node_modules/adminlte-reactjs/node_modules/react-dom/lib
@ ./~/adminlte-reactjs/~/react-dom/lib/ReactDOMUnknownPropertyHook.js 15:29-72

Cannot find module react/lib/ReactComponentTreeHook

Cannot find module react lib ReactComponentTreeHook

Uncaught Error: Cannot find module “react/lib/ReactComponentTreeHook” · Issue #2 · jmarceli/redux-elm-boilerplate

https://github.com/jmarceli/redux-elm-boilerplate/issues/2

Cannot find module ‘react/lib/ReactComponentTreeHook’ · Issue #1 · kodefox/mocha-react-native

https://github.com/kodefox/mocha-react-native/issues/1

Error: Cannot find module ‘react-dom/lib/ReactPerf’ from ‘react/lib/ReactAddonsDOMDependencies.js’ · Issue #8556 · facebook/react

https://github.com/facebook/react/issues/8556

Cannot find module ‘react/lib/ReactTestUtils’ · Issue #724 · airbnb/enzyme

https://github.com/airbnb/enzyme/issues/724

Unable to resolve module `react/lib/ReactComponentWithPureRenderMixin` · Issue #923 · react-community/react-navigation

https://github.com/react-community/react-navigation/issues/923

javascript – Cannot find module ‘react/lib/ReactComponentTreeHook’ from ‘ReactDebugTool.js’ – Stack Overflow

https://stackoverflow.com/questions/44680414/cannot-find-module-react-lib-reactcomponenttreehook-from-reactdebugtool-js

reactjs – Jest fails with error: Cannot find module ‘react/lib/ReactComponentTreeHook’ – Stack Overflow

https://stackoverflow.com/questions/40911760/jest-fails-with-error-cannot-find-module-react-lib-reactcomponenttreehook

➜  react-hot-boilerplate git:(master) ✗ npm install –save react@15.4.0 react-dom@15.4.0
npm WARN react-dom@15.6.1 requires a peer of react@^15.6.1 but none was installed.
added 4 packages, removed 3 packages and updated 2 packages in 6.617s

结果:

去运行:

npm start

倒是可以正常运行的:

【总结】

当:

Uncaught Error Cannot find module react/lib/ReactComponentTreeHook

时,去安装最新的,稳定版本的,且react和react-dom一致的版本,即可解决,比如:

npm install –save react@15.4.0 react-dom@15.4.0

即可。

转载请注明:在路上 » 【已解决】Reactjs出错:Uncaught Error Cannot find module react/lib/ReactComponentTreeHook

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
61 queries in 0.122 seconds, using 18.87MB memory