Haste 模块命名冲突:使用 AWS 服务 (Amplify Project) 反应本机应用程序
Haste module naming collision: react native app with AWS Service (Amplify Project)
我已经开始使用 React Native 项目,之前是使用本地代码。
我想添加 Amazon Lex,所以按照 link
中的以下步骤操作
https://aws-amplify.github.io/docs/js/interactions
下面是我的 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',
},
});
我刚刚设置了放大库并为 LEX 添加了交互,但是当我尝试 运行 应用程序时开始出现以下错误。添加之前工作正常......一旦创建了 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
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
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。
我尝试了以下解决方案但没有用
我只是按照步骤......我哪里出错了......遗漏了任何东西......
请帮助...这是我的第一个反应本机应用程序....我真的迷路了
经过许多不眠之夜并测试不同的解决方案后,我终于能够通过..我正在使用最新的 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
}
我呼吸了新鲜空气...现在一切正常...
请不要创建新的 metro.config.js 或 rn-cli.config.js。使用 #current-cloud-backend 而非 backend 文件夹编辑当前 metro.config.js。这个非常重要。
后端将被忽略....
这将在未来帮助某人......因为无论给出什么解决方案都没有用......对于最新的原生反应。
我已经开始使用 React Native 项目,之前是使用本地代码。 我想添加 Amazon Lex,所以按照 link
中的以下步骤操作https://aws-amplify.github.io/docs/js/interactions
下面是我的 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',
},
});
我刚刚设置了放大库并为 LEX 添加了交互,但是当我尝试 运行 应用程序时开始出现以下错误。添加之前工作正常......一旦创建了 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
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.jsonThis 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。
我尝试了以下解决方案但没有用
我只是按照步骤......我哪里出错了......遗漏了任何东西...... 请帮助...这是我的第一个反应本机应用程序....我真的迷路了
经过许多不眠之夜并测试不同的解决方案后,我终于能够通过..我正在使用最新的 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
}
我呼吸了新鲜空气...现在一切正常...
请不要创建新的 metro.config.js 或 rn-cli.config.js。使用 #current-cloud-backend 而非 backend 文件夹编辑当前 metro.config.js。这个非常重要。 后端将被忽略....
这将在未来帮助某人......因为无论给出什么解决方案都没有用......对于最新的原生反应。