这在开发过程中似乎是随机发生的.当try 运行npm startreact-native run-ios时,我得到以下错误:

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json collides with /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/Libraries/Animated/release/package.json

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json collides with /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/Libraries/Animated/release/package.json

This error is caused by a @providesModule declaration with the same name accross two different files.
    at HasteMap._updateHasteMap (/Users/chandlervdw/Repos/Relay/mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:162:15)
    at /Users/chandlervdw/Repos/Relay/mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:140:25

奇怪的是,/Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json确实把react-native-vector-icons列为模块的名称???

如果我删除了那个文件,错误就不会再发生了,但打包机会被困在93%的位置,并抱怨找不到一个完全无关的库.

我放弃了回购协议,甚至重新安装了所有东西,包括npmrnpm,甚至升级了node.我正在运行与我的队友相同的所有版本,他们能够毫无问题地运行打包机.

推荐答案

Posting this as an answer just in case anybody else has this issue in future.

当nodes package manager运行初始构建阶段时,使用sudo权限运行npm start将授予正确的权限.这似乎只有在您运行的shell/用户具有受限权限时才会发生.强制将权限升级到sudo使包管理器能够完全控制完成构建.

React-native相关问答推荐

AxiosError:Reaction Native EXPO开发版本中的网络错误

如何在Recact Native中单击Back按钮后调用函数

React native + react-query + onError 不捕获并处理错误?

React Native TextInput 在android上打开时会自动关闭

我如何限制 FlatList 中的元素并增加负载?

错误:HostFunction 中的异常: Malformed calls from JS: field sizes are different. In an Animated View

最近 react-native 版本中的Unable to resolve moduledebuggerWorker 错误

用于部署后设置的 React 配置文件

React Native 中如何使用 Flex 居中组件?

如何将抖动动画添加到视图(react-native)?

React-Native 应用程序的 Jest 测试 Animated.View

如何在 React Native 中按下按钮时更改文本值?

Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

React Native - SectionList numColumns support

无法加载 exp:// 出了点问题

在 React Native (iOS) 中支持动态类型

DeviceInfo 原生模块未正确安装

如何在本地构建 Expo APK

React 本机矢量图标在当前版本 0.60 上不起作用

安卓启动问题:Unsupported class file major version 57