作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 package.json
中使用本地模块,该模块也有 react-native
作为依赖项。
在我的应用程序中package.json
:
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-services": "file:///Users/R01/Projects/react-native-services"
在我的react-native-services
package.json
中:
"react": "16.4.1",
"react-native": "0.56.0"
因此,当运行 react-native run-android
时,Metro Bundler 会抛出:
Looking for JS files in
/Users/R01/Projects/RNApp
/Users/R01/Projects/react-native-services
Metro Bundler ready.
Loading dependency graph...(node:72824) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
(node:72824) 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)
(node:72824) [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.
error: bundling failed: Error: jest-haste-map: @providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
我已经尝试过:
npm
和 yarn
(升级版),但 react-native run-android
始终抛出相同的错误。最佳答案
watchman watch-del-all
rm -rf node_modules && npm install
rm -fr $TMPDIR/react-*
npm cache clean
npm start -- --reset-cache
关于react-native - 错误: jest-haste-map: @providesModule naming collision when using a local dependency,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52905842/
当我运行 npm start 或 react-native start 时,我收到了这个警告: jest-haste-map: @providesModule naming collision:
我们有两个 repos,它们都有 react-native 作为依赖项;一个是实际的 RN 应用程序,另一个是 UI 包,其中包含许多自定义的 react-native 组件。 当我使用 RN 应用程
我在 package.json 中使用本地模块,该模块也有 react-native 作为依赖项。 在我的应用程序中package.json: "react": "16.4.1", "react-na
我是一名优秀的程序员,十分优秀!