如果我以以下方式启动Metro:
react-native run ios --reset-cache
,该应用程序可以在我的USB连接设备上正常运行。
如果我在Xcode中启动该应用程序,则该应用程序不再工作(以前已工作)。 现在我得到了这个错误:
2019-02-07 09:49:34.188 [错误] [tid:NSOperationQueue 0x281c0ede0(QOS: 未找到)] [RCTCxxBridge.mm:429]加载失败 捆绑包(http://169.254.10.166:8081/index.bundle?platform=ios&dev=true&minify=false) 出现错误:
(无法解析模块
../../../native-base-theme/components
来自/Users/me/Projects/SuperProject/develop/app/index.js
:模块 找不到
../../../native-base-theme/components
/Users/me/Projects/SuperProject/develop/app/index.js
。的确, 这些文件都不存在:
/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)
(空))
我不明白,为什么会有带有../../../的路径,它指向我的项目目录之外。
是否使用了某种XCode缓存,或者一个Path-Variable可能是错误的?
这是我的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"
}
在GitHub上找到了问题说明,这似乎正是我的问题所在:
https://github.com/tleunen/babel-plugin-module-resolver/issues/29#issuecomment-304763384
主要问题似乎是一个本机&& xcode错误。 Xcode似乎从另一个目录启动打包程序,这是打包程序中路径错误的原因。