放大:Expo 无法连接到开发服务器

Amplify: Expo Could not connect to development server

我有一个 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)

这是什么以及如何解决?

此答案来自与 Amplify API 有类似问题的人,请在此处找到:

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

Amplify creates a copy of your current cloud backend configuration in amplify/#current-cloud-backend/.

You don't need those files to build your app, so you can ignore them in order to get rid of the error.

To do so, you can create a blacklist and add the folder to it. Create a rn-cli.config.js file in the root of your project.

./rn-cli.config.js:

require('metro').createBlacklist;

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {   resolver: {
    blacklistRE: blacklist([/#current-cloud-backend\/.*/]),   }, }; ```

查看此处给出的答案: