重复的模块名称:create-react-context。在不同文件中使用相同名称声明

时间:2019-01-10 07:10:17

标签: react-native react-native-android jsx react-native-ios react-native-navigation

我有以下React Native项目:

https://github.com/napolev/react-native-paper

是我从其官方GitHub存储库中克隆的

(到目前为止完全没有更改)。

要安装并运行它,我做了:

$ git clone https://github.com/napolev/react-native-paper
$ cd react-native-paper
$ npm i
$ cd example
$ npm i
$ expo start

在终端上收到QR代码后,我用AndroidiOS智能手机对它进行了扫描,然后在终端上出现以下错误:

$ expo start
[00:53:27] Starting project at D:\react-native-paper\example
[00:53:28] Expo DevTools is running at http://localhost:19002
[00:53:36] Starting Metro Bundler on port 19001.
[00:53:38] Tunnel ready.
[00:53:38] Your app is running at exp://192.168.1.194:19000
Logs for your project will appear below. Press Ctrl+C to exit.
[00:53:52] jest-haste-map: @providesModule naming collision:
[00:53:52]   Duplicate module name: create-react-context
[00:53:52]   Paths: D:\react-native-paper\example\node_modules\react-navigation\node_modules\create-react-context\package.json collides with D:\react-native-paper\example\node_modules\create-react-context\package.json
[00:53:52]
[00:53:52] This error is caused by a @providesModule declaration with the same name across two different files.
[00:53:52] (node:9828) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
[00:53:52]   Duplicate module name: create-react-context
[00:53:52]   Paths: D:\react-native-paper\example\node_modules\react-navigation\node_modules\create-react-context\package.json collides with D:\react-native-paper\example\node_modules\create-react-context\package.json
[00:53:52]
[00:53:52] This error is caused by a @providesModule declaration with the same name across two different files.
[00:53:52]     at setModule (D:\react-native-paper\example\node_modules\jest-haste-map\build\index.js:462:17)
[00:53:52]     at workerReply (D:\react-native-paper\example\node_modules\jest-haste-map\build\index.js:512:9)
[00:53:52]     at <anonymous>
[00:53:52]     at process._tickCallback (internal/process/next_tick.js:188:7)
[00:53:52] (node:9828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
[00:53:52] (node:9828) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

此外,在我的两部手机上,我都得到了以下信息:

enter image description here

我不明白为什么应该以为该存储库的作者可以立即安装并运行而无法运行它。

关于如何使它起作用的任何想法?

谢谢!

1 个答案:

答案 0 :(得分:0)

该项目使用cursor='something'作为依赖项管理器,并且正在使用特定功能来为其依赖项进行选择性的版本解析。参见try: import tkinter as tk except ImportError: import Tkinter as tk class Settings: def __init__(self, master): # Elements of the menu self.master=master self.menu = tk.Menu(root, fg="red") self.subMenu = tk.Menu(self.menu, cursor="hand1") def openMenu(self): # Configuration of the menu self.menu.add_cascade(label="Options", menu=self.subMenu) self.addOptionsSubMenu() self.master.config(menu=self.menu) def addOptionsSubMenu(self): # Add elements at the sub menu self.subMenu.add_command(label="Quit", command=self.quit) self.subMenu.add_command(label="Do nothing", command=self.passa) # Quit the function def quit(self): exit() # Do nothing def passa(self): pass root = tk.Tk() app = Settings(root) app.openMenu() root.mainloop()

yarn

清除您的package.json,然后使用"resolutions": { "**/create-react-context": "0.2.3", ... 重新安装。