我将我的react native应用程序从0.48.3升级到0.59.8,一切正常,直到启动模拟器。然后出现此错误:
error: bundling failed: Error: Unable to resolve module
`@babel/runtime/helpers/interopRequireDefault` from
`E:\als\variant\generic\index.android.js`: Module
`@babel/runtime/helpers/interopRequireDefault` does not exist in the
Haste module map
这是我的Package.json:
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@babel/runtime": "^7.0.0-beta.55",
"babel-loader": "^8.0.5",
"content-disposition": "^0.5.2",
"core-js": "^3.0.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-loader": "^2.4.5",
"react-native": "0.59.8",
"react-redux": "^5.0.6",
"react-router-dom": "^5.0.0",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"@babel/plugin-transform-block-scoping": "^7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/plugin-transform-react-jsx-source": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.3",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.8.0",
"babel-preset-react-native": "^5.0.2",
}
我已经尝试了所有在类似问题中找到的解决方案,但是都无法正常工作。请问您有什么想法吗?
答案 0 :(得分:1)
在您的依赖项中看不到运行时
npm install --save @babel/runtime
此外,尝试使用重置缓存
npm run start --reset-cache
答案 1 :(得分:1)
我也遇到了同样的问题,在线程上没有提到解决方案。但是我终于能够通过删除并重新安装react-native的全局版本来解决它:
npm uninstall react-native -g
npm install react-native@latest -g
然后我重新运行该错误时消失了:
react-native start