我在运行我的(刚刚创建的)React Native应用程序时遇到问题。我读到了
error Cannot find module '@babel/runtime/helpers/interopRequireDefault'
但是更改package.json的每种可能组合都无济于事。
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "7.0.0-beta.55",
"@react-native-community/eslint-config": "^0.0.5",
"@types/jest": "^24.0.18",
"@types/react-native": "^0.60.21",
"@types/react-test-renderer": "16.9.1",
"babel-jest": "^24.9.0",
"eslint": "^6.6.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.57.0",
"react-test-renderer": "16.12.0",
"typescript": "^3.6.3"
},
我已经更改了 @ babel / runtime版本,因为我在解决方案中发现了它,但是在 react-native start 之后,我仍然得到了:
error Cannot find module '@babel/runtime/helpers/interopRequireDefault'. Run CLI with --verbose flag for more details.
Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\User\AppData\Local\Yarn\Data\global\node_modules\@react-native-community\cli-debugger-ui\build\middleware\index.js:3:30)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
有趣的是,在react-native运行android之后,我看到消息,编译成功(在控制台中),但我无法运行我的应用并获取:
Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release.
在智能手机上。