Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve module 'react/lib/ReactMount' i #13

Closed
lazyou opened this issue Nov 19, 2016 · 7 comments
Closed

Cannot resolve module 'react/lib/ReactMount' i #13

lazyou opened this issue Nov 19, 2016 · 7 comments

Comments

@lazyou
Copy link

lazyou commented Nov 19, 2016

npm start 报错如下:

ERROR in ./src/app.js
Module not found: Error: Cannot resolve module 'react/lib/ReactMount' in /Applications/XAMPP/xamppfiles/htdocs/react-demo/src
 @ ./src/app.js 1:330-361

发现是 react 版本 15.3.1 安装下来是 15.4.0.
为啥会这样? 怎么解决?
谢谢。

@kenberkeley
Copy link
Owner

npm i [email protected]

@lazyou
Copy link
Author

lazyou commented Nov 19, 2016

能运行了。
报了下面错误:

[email protected] /react-demo
└── UNMET PEER DEPENDENCY [email protected]

npm WARN [email protected] requires a peer of react@^15.4.0 but none was installed.
npm ERR! code 1

我的环境:

  • node : v4.4.7
  • npm : 3.10.9

@kenberkeley
Copy link
Owner

不如这样吧,您把整个 node_modules 删掉,再用 cnpm i 安装,应该就没问题了

@lazyou
Copy link
Author

lazyou commented Nov 19, 2016

这样不行, 还是安装了 15.4.0 的版本

@kenberkeley
Copy link
Owner

为了解决该问题,我将 React 锁在了 15.3.x。现在您可以这样解决:

> npm uni react react-dom
> cnpm i [email protected] [email protected]

@kenberkeley
Copy link
Owner

说实在的,React 复杂多变的版本迭代让我感到非常不靠谱。。。

@kenberkeley
Copy link
Owner

最近项目有点小忙,一直都没有理会 demo 的事情
有关 React 15.3 升级到 15.4 的问题,网上也有太多讨论
最权威的目测是这个 gaearon/react-hot-loader#417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants