【发布时间】:2018-07-30 16:28:04
【问题描述】:
我正在尝试升级 React Native,但遇到了以下问题:
error: bundling: UnableToResolveError: Unable to resolve module `react/lib/ReactComponentTreeHook` from `/Users/anthony/dev/apptova-react/node_modules/react-native/Libraries/Performance/Systrace.js`: Module does not exist in the module map or in these directories:
/Users/anthony/dev/apptova-react/node_modules/react-native/node_modules/react/lib
, /Users/anthony/dev/apptova-react/node_modules/react/lib
我很困惑。我在 node_modules 的任何地方都找不到任何名为 ReactComponentTreeHook 的库。
我已经尝试删除 node_modules 文件夹并重新安装,nada。我还清除了守望者手表并重置了打包程序缓存。
编辑:我一直遇到似乎源于 react-native-maps 的问题,所以我重置回一个工作稳定的版本,卸载 react-native-maps,然后运行 react- native-git-upgrade(再次)。
现在我得到了:
error: bundling: UnableToResolveError: Unable to resolve module `react/lib/ReactDebugCurrentFrame` from `/Users/anthony/dev/apptova-react/node_modules/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js`: Module does not exist in the module map or in these directories:
/Users/anthony/dev/apptova-react/node_modules/react-native/node_modules/react/lib
, /Users/anthony/dev/apptova-react/node_modules/react/lib
我只是在尝试最新的,我的 package.json 依赖项很简单,所以我认为它不会与第三方代码库冲突:
"dependencies": {
"react": "15.4.1",
"react-native": "^0.43.1",
"react-native-drawer": "^2.3.0"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-plugin-transform-flow-strip-types": "^6.21.0",
"babel-preset-react-native": "1.9.1",
"deepmerge": "^1.3.2",
"flow-bin": "^0.37.4",
"jest": "18.0.0",
"react-test-renderer": "15.4.1"
},
再次,经历了清除守望者手表、节点模块、重置包管理器的过程,仍然出现此错误。
编辑 2: 在花了两天时间尝试让这个工作正常运行后,我创建了一个新的空白项目并迁移了我的代码。
【问题讨论】:
-
您在运行 npm install 时是否收到任何警告?
标签: node.js reactjs react-native