./~/react-tap-event-plugin/src/injectTapEventPlugin.js 中的错误 [英] ERROR in ./~/react-tap-event-plugin/src/injectTapEventPlugin.js

查看:25
本文介绍了./~/react-tap-event-plugin/src/injectTapEventPlugin.js 中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里反应菜鸟.尝试克隆并运行 https://github.com/strangebnb/react-airbnb

React noob here. Trying to clone and run https://github.com/strangebnb/react-airbnb

我克隆.运行 npm 安装.然后 webpack 但我得到

I clone. run npm install. Then webpack but I get

ERROR in ./~/react-tap-event-plugin/src/injectTapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginHub' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/injectTapEventPlugin.js 23:2-37

ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventConstants' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/TapEventPlugin.js 22:21-56

ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginUtils' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/TapEventPlugin.js 23:23-60

ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPropagators' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/TapEventPlugin.js 24:23-60

ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/SyntheticUIEvent' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/TapEventPlugin.js 25:23-60

ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/ViewportMetrics' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
 @ ./~/react-tap-event-plugin/src/TapEventPlugin.js 27:22-58

ERROR in ./~/react-portal/build/portal.js
Module not found: Error: Cannot resolve module 'react/lib/CSSPropertyOperations' in /Users/thomas/tom/node_modules/react-portal/build
 @ ./~/react-portal/build/portal.js 17:29-71

我找到了 https://github.com/thereactivestack/meteor-webpack/issues/21(我看到这是最近的,阅读:昨天),在搞砸了我的 packages.json 之后,更改了 react、react-dom、material-ui 版本号并运行 npm i --save react-tap-event-plugin,我得到了只有"1 条错误消息

I found https://github.com/thereactivestack/meteor-webpack/issues/21 (I see this is very recent, read: yesterday), and after messing around with my packages.json, changing react, react-dom, material-ui version numbers and running npm i --save react-tap-event-plugin, I got down to 'only' 1 error message

ERROR in ./~/react-portal/build/portal.js
Module not found: Error: Cannot resolve module 'react/lib/CSSPropertyOperations' in /Users/thomas/react-airbnb/node_modules/react-portal/build
 @ ./~/react-portal/build/portal.js 17:29-71

我是新手,不知道如何解决这个问题.非常欢迎任何提示.

I'm pretty new and I'm not sure how to go about fixing this. Any hints greatly welcomed.

谢谢

推荐答案

我分叉了那个 repo 并在我的 repo 中修复了这个问题.此外,向原始回购的所有者发送了拉取请求.这是我的分叉仓库的链接:https://github.com/pankajvishwani/react-airbnb

I forked that repo and fixed this issue in my repo. Also, sent pull request to the owner of original repo. Here's link to my forked repo: https://github.com/pankajvishwani/react-airbnb

如果你不想克隆我的 repo,你可以在 webpack.config.js 中添加以下内容:

If you don't want to clone my repo, you can add the following in webpack.config.js:

var reactDomLibPath = path.join(__dirname, "./node_modules/react-dom/lib");
var alias = {};
["EventPluginHub", "EventConstants", "EventPluginUtils", "EventPropagators",
 "SyntheticUIEvent", "CSSPropertyOperations", "ViewportMetrics"].forEach(function(filename){
    alias["react/lib/"+filename] = path.join(__dirname, "./node_modules/react-dom/lib", filename);
});

module.exports = {
  ...
  resolve: {alias: alias},
  ...
}

这篇关于./~/react-tap-event-plugin/src/injectTapEventPlugin.js 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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