急件模块命名冲突:将本机应用程序与AWS Service(Amplify Project)进行反应 [英] Haste module naming collision: react native app with AWS Service (Amplify Project)

查看:72
本文介绍了急件模块命名冲突:将本机应用程序与AWS Service(Amplify Project)进行反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用react本机项目,更早的时候是本机代码. 我想添加Amazon Lex,因此从链接执行以下步骤

i have started with react native project, earlier was in native code. i wanted to add Amazon Lex so followed below steps from link

https://aws-amplify.github.io/docs/js/interactions

下面是我的App.js文件

below is my App.js file

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',
  },
});

我刚刚为LEX设置了一个放大库并添加了交互功能,但是当我尝试运行应用程序时开始出现错误提示.

i have just set up amplify library and added interaction for LEX, but started getting below error as i try to run app. before adding was working fine...once Amplify folder got created with back-end error started.....

(节点:26180)UnhandledPromiseRejectionWarning:错误:玩味-急速图: 急速模块命名冲突:重复的模块名称: myamplifyproject_cfnlambda_87887b9a路径: C:\ Users \ temp \ Desktop \ myAmplifyProject \ amplify \ backend \ interactions \ lex900662fd \ src \ package.json 与…相撞 C:\ Users \ temp \ Desktop \ myAmplifyProject \ amplify#current-cloud-backend \ interactions \ lex900662fd \ src \ package.json

(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

此错误是由hasteImpl返回相同的名称引起的 不同的文件. 在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) 在processTicksAndRejections(internal/process/task_queues.js:93:5) 在异步Promise.all(索引30)错误18:24(节点:26180)UnhandledPromiseRejectionWarning:未处理的承诺拒绝.这 由抛出异步函数引起的错误 没有障碍,或者拒绝了没有处理的承诺 使用.catch(). (拒绝ID:2)(节点:26180)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝.在 未来,未处理的承诺拒绝将终止 使用非零退出代码的Node.js进程. (节点:26180) UnhandledPromiseRejectionWarning:错误:jest-haste-map:加速模块 命名冲突:重复的模块名称: myamplifyproject_cfnlambda_87887b9a路径: C:\ Users \ temp \ Desktop \ myAmplifyProject \ amplify \ backend \ interactions \ lex900662fd \ src \ package.json 与…相撞 C:\ Users \ temp \ Desktop \ myAmplifyProject \ amplify#current-cloud-backend \ interactions \ lex900662fd \ src \ package.json

This error is caused by hasteImpl returning the same name for different files. 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. 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:26180) [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. (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

此错误是由hasteImpl返回相同的名称引起的 不同的文件. 在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) 在processTicksAndRejections(internal/process/task_queues.js:93:5) 在异步Promise.all(索引30)(节点:26180)处UnhandledPromiseRejectionWarning:未处理的诺言拒绝.这 由抛出异步函数引起的错误 没有障碍,或者拒绝了没有处理的承诺 使用.catch(). (拒绝ID:3)

This error is caused by hasteImpl returning the same name for different files. 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. 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: 3)

我已经使用了所有最新版本的react-native.

i have used all latest versions for 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

推荐答案

经过不眠之夜并测试了不同的解决方案,我终于能够通过..i我使用的是最新的react-native> 0.59(我猜是0.61) 我的应用程序已经在根目录下创建了metro.config.js文件,必须对其进行编辑.

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.

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...

请不要创建新的metro.config.js或rn-cli.config.js.使用#current-cloud-backend 而不是 backend 文件夹编辑当前的metro.config.js.这个非常重要. 后端将被忽略....

please do not create new metro.config.js or rn-cli.config.js. edit present metro.config.js with #current-cloud-backend not backend folder. 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.

这篇关于急件模块命名冲突:将本机应用程序与AWS Service(Amplify Project)进行反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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