[英]Haste module naming collision: react native app with AWS Service (Amplify Project)
i have started with react native project, earlier was in native code.我已经开始使用 react native 项目,之前是在本地代码中。 i wanted to add Amazon Lex so followed below steps from link
我想添加 Amazon Lex,所以按照链接中的以下步骤操作
https://aws-amplify.github.io/docs/js/interactions https://aws-amplify.github.io/docs/js/interactions
below is my App.js file下面是我的 App.js 文件
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
i have just set up amplify library and added interaction for LEX, but started getting below error as i try to run app.我刚刚设置了放大库并为 LEX 添加了交互,但是当我尝试运行应用程序时开始出现错误。 before adding was working fine...once Amplify folder got created with back-end error started.....
在添加之前工作正常......一旦创建了 Amplify 文件夹并开始出现后端错误......
(node:26180) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision: Duplicate module name: myamplifyproject_cfnlambda_87887b9a Paths: C:\Users\temp\Desktop\myAmplifyProject\amplify\backend\interactions\lex900662fd\src\package.json collides with C:\Users\temp\Desktop\myAmplifyProject\amplify#current-cloud-backend\interactions\lex900662fd\src\package.json
(节点:26180) UnhandledPromiseRejectionWarning:错误:jest-haste-map:Haste 模块命名冲突:重复的模块名称:myamplifyproject_cfnlambda_87887b9a 路径:C:\Users\temp\Desktop\myAmplifyProject\amplify6620\interactions\rc\lexpackage. json 与 C:\Users\temp\Desktop\myAmplifyProject\amplify#current-cloud-backend\interactions\lex900662fd\src\package.Z4668716ECDF35FCA56D 冲突
This error is caused by
hasteImpl
returning the same name for different files.这个错误是由
hasteImpl
为不同的文件返回相同的名称引起的。 at setModule (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:569:17) at workerReply (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:641:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 30) ERROR 18:24 (node:26180) UnhandledPromiseRejectionWarning: Unhandled promise rejection.在 setModule (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:569:17) 在 workerReply (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest- haste-map\build\index.js:641:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 30) ERROR 18:24 (node:26180) UnhandledPromiseRejectionWarning: Unhandled promise 拒收。 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().
此错误源于在没有 catch 块的情况下抛出异步 function 内部,或拒绝未使用.catch() 处理的 promise。 (rejection id: 2) (node:26180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
(拒绝 ID:2)(节点:26180)[DEP0018] DeprecationWarning:不推荐使用未处理的 promise 拒绝。 In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
将来,未处理的 promise 拒绝将使用非零退出代码终止 Node.js 进程。 (node:26180) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision: Duplicate module name: myamplifyproject_cfnlambda_87887b9a Paths: C:\Users\temp\Desktop\myAmplifyProject\amplify\backend\interactions\lex900662fd\src\package.json collides with C:\Users\temp\Desktop\myAmplifyProject\amplify#current-cloud-backend\interactions\lex900662fd\src\package.json
(节点:26180) UnhandledPromiseRejectionWarning:错误:jest-haste-map:Haste 模块命名冲突:重复的模块名称:myamplifyproject_cfnlambda_87887b9a 路径:C:\Users\temp\Desktop\myAmplifyProject\amplify6620\interactions\rc\lexpackage. json 与 C:\Users\temp\Desktop\myAmplifyProject\amplify#current-cloud-backend\interactions\lex900662fd\src\package.Z4668716ECDF35FCA56D 冲突
This error is caused by
hasteImpl
returning the same name for different files.这个错误是由
hasteImpl
为不同的文件返回相同的名称引起的。 at setModule (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:569:17) at workerReply (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:641:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 30) (node:26180) UnhandledPromiseRejectionWarning: Unhandled promise rejection.在 setModule (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:569:17) 在 workerReply (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest- haste-map\build\index.js:641:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 30) (node:26180) UnhandledPromiseRejectionWarning: Unhandled ZB321DE37BDC299EC807D 拒绝。 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().
此错误源于在没有 catch 块的情况下抛出异步 function 内部,或拒绝未使用.catch() 处理的 promise。 (rejection id: 3)
(拒绝编号:3)
i have used all latest versions for react-native.我已经使用了 react-native 的所有最新版本。
i tried below solution but not working how to make react native packager ignore certain directories我尝试了下面的解决方案,但没有工作如何让反应本机打包程序忽略某些目录
i just follwed steps...where i am going wrong....missing anything.... Please help...this is my first app in react native.... i am actually lost我只是按照步骤......我哪里出错了......错过了任何东西......请帮助......这是我第一个反应原生的应用程序......我真的迷路了
after lots of sleepless nights and testing different solution i finally able to get through..i am using latest react-native > 0.59 (i guess 0.61) my app already created metro.config.js file at the root directory, one has to edit same.经过许多不眠之夜和测试不同的解决方案,我终于能够通过..我正在使用最新的 react-native > 0.59(我猜是 0.61)我的应用程序已经在根目录中创建了 metro.config.js 文件,必须编辑相同的文件。
const blacklist = require('metro-config/src/defaults/blacklist'); // on top
resolver: {
blacklistRE: blacklist([/#current-cloud-backend\/.*/]) //add within module export
}
and i took fresh air...now everything works fine...我呼吸了新鲜空气……现在一切正常……
please do not create new metro.config.js or rn-cli.config.js.请不要创建新的 metro.config.js 或 rn-cli.config.js。 edit present metro.config.js with #current-cloud-backend not backend folder.
使用#current-cloud-backend而不是后端文件夹编辑当前的 metro.config.js。 this is very important.
这个非常重要。 backend will be ignored....
后端将被忽略....
this will help someone in future....as nothing works which ever solutions are given....for latest react native.这将对将来的某人有所帮助....因为给出的解决方案都不起作用....对于最新的本机反应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.