【问题标题】:Amplify: Expo Could not connect to development server放大:Expo 无法连接到开发服务器
【发布时间】:2021-10-11 18:15:08
【问题描述】:

我有一个 React-Native 应用程序,在使用 expo start --web 进行测试时使用与 Expo 配合使用的 AWS Amplify,但我试图在我的 iOS 设备上进行测试并得到一个 Could not connect to development server. 错误。 URL: http://192.168.1.6:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false&minify=false

编辑:我尝试使用amplify pull 启动一个空白项目,然后出现此错误:

jest-haste-map: Haste module naming collision: projectamplifyjsc7fc9745PostConfirmation
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>\amplify\#current-cloud-backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json
    * <rootDir>\amplify\backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json    

Failed to construct transformer:  DuplicateError: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
    at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 50) {
  mockPath1: 'amplify\\#current-cloud-backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json',
  mockPath2: 'amplify\\backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json'}
Error: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
    at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 50)
Error: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
    at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 50)

这是什么以及如何解决?

【问题讨论】:

    标签: ios react-native expo aws-amplify


    【解决方案1】:

    这个答案来自与 Amplify API 有类似问题的人,在这里找到它:Amplify React Native - Duplicate Error using amplify add api

    解决方案很简单(至少对我来说,猜测可能取决于您使用的放大服务)。

    Amplify 会在 amplify/#current-cloud-backend/.

    您不需要这些文件来构建您的应用,因此您可以忽略它们 为了摆脱错误。

    为此,您可以创建一个黑名单并将文件夹添加到其中。创造 项目根目录中的 rn-cli.config.js 文件。

    ./rn-cli.config.js:

    require('metro').createBlacklist;
    
    const blacklist = require('metro-config/src/defaults/blacklist');
    
    module.exports = {   resolver: {
        blacklistRE: blacklist([/#current-cloud-backend\/.*/]),   }, }; ```
    

    查看此处给出的答案:https://stackoverflow.com/a/60899723/11255886

    【讨论】:

      猜你喜欢
      • 2020-07-05
      • 1970-01-01
      • 2017-10-11
      • 2016-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-28
      • 2021-12-28
      相关资源
      最近更新 更多