Xcode wrong Path to Module

£可爱£侵袭症+ 提交于 2021-01-28 06:51:08

问题


If I start Metro with: react-native run ios --reset-cache, the app working well at my USB-Connected Device.

If I start the App in Xcode, the App didn't work anymore (worked before). Now I got this error:

2019-02-07 09:49:34.188 [error][tid:NSOperationQueue 0x281c0ede0 (QOS: UNSPECIFIED)][RCTCxxBridge.mm:429] Failed to load bundle(http://169.254.10.166:8081/index.bundle?platform=ios&dev=true&minify=false) with error:

(Unable to resolve module ../../../native-base-theme/components from /Users/me/Projects/SuperProject/develop/app/index.js:

The module ../../../native-base-theme/components could not be found from /Users/me/Projects/SuperProject/develop/app/index.js.

Indeed, none of these files exist:

  • /Users/me/Projects/native-base-theme/components(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)

  • /Users/me/Projects/native-base-theme/components/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx) (null))

I don't see, why there are this Path with ../../../ which points far out of my project-directory.

Is there some kind of cache XCode use, or might one Path-Variable be wrong?

Here is my package.json:

"dependencies": {
    "fbjs": "^0.8.17",
    "lodash": "^4.17.11",
    "lodash.isequal": "^4.5.0",
    "native-base": "https://github.com/xstable/NativeBase.git",
    "npm": "^5.8.0",
    "prop-types": "^15.6.1",
    "react": "16.4.1",
    "react-devtools": "^3.2.1",
    "react-native": "^0.56.1",
    "react-native-cacheable-image": "^2.0.0",
    "react-native-fast-image": "^5.1.2",
    "react-native-firebase": "^4.3.8",
    "react-native-grid-list": "^1.0.9",
    "react-native-image-zoom-viewer": "^2.2.23",
    "react-native-modal-dropdown": "^0.6.2",
    "react-native-render-html": "^3.9.3",
    "react-native-safe-area-view": "^0.7.0",
    "react-native-scrolling-menu": "experiment322/react-native-scrolling-menu",
    "react-native-transformable-image": "https://github.com/xstable/react-native-transformable-image.git",
    "react-native-vector-icons": "^6.1.0",
    "react-native-video": "tranvinhtruong/react-native-video",
    "react-native-video-player": "https://github.com/tranvinhtruong/react-native-video-player",
    "react-native-youtube": "^1.1.0",
    "react-navigation": "^1.5.11",
    "reactotron-react-native": "^1.14.0",
    "webpack": "^4.5.0"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-flow": "^7.0.0",
    "@babel/register": "^7.0.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^9.0.0",
    "babel-jest": "^23.4.2",
    "babel-plugin-transform-remove-console": "^6.9.2",
    "babel-preset-react-native": "^5.0.2",
    "eslint": "^5.12.1",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.11.1",
    "eslint-plugin-react-native": "^3.2.1",
    "jest": "23.6.0",
    "react-test-renderer": "16.6.1"
  },
  "jest": {
    "preset": "react-native"
  }

Found an Issue-Description on GitHub, which seems to be exactly what my issue is:

https://github.com/tleunen/babel-plugin-module-resolver/issues/29#issuecomment-304763384

The main-Issue seems to be an react-native && xcode Bug. Xcode seems to start the packager from another directory, which's the cause of wrong paths in the bundler.

来源:https://stackoverflow.com/questions/54569662/xcode-wrong-path-to-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!